From c656e0e72cc1908aed53f1eb03839c2baf387399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=C4=B1ner=20K=C4=B1sa?= <88156124+akinerkisa@users.noreply.github.com> Date: Thu, 17 Oct 2024 00:20:34 +0300 Subject: [PATCH] Update test_string_utils.py Added different test scenarios to explain the testcase class. --- 4-testing/17-assertions/test_string_utils.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/4-testing/17-assertions/test_string_utils.py b/4-testing/17-assertions/test_string_utils.py index c5e88eb..d946680 100644 --- a/4-testing/17-assertions/test_string_utils.py +++ b/4-testing/17-assertions/test_string_utils.py @@ -7,13 +7,27 @@ class TestStringUtils(unittest.TestCase): def test_reverse_string(self): + # Test cases for reversing a string self.assertEqual(reverse_string('mochi'), 'ihcom') - + self.assertEqual(reverse_string('hello'), 'olleh') + self.assertEqual(reverse_string('Python'), 'nohtyP') + self.assertEqual(reverse_string(''), '') # Empty string case + def test_capitalize_string(self): + # Test cases for capitalizing a string self.assertEqual(capitalize_string('mochi'), 'Mochi') + self.assertEqual(capitalize_string('hello'), 'Hello') + self.assertEqual(capitalize_string('python'), 'Python') + self.assertEqual(capitalize_string('hELLO'), 'Hello') # Should fix mixed case + self.assertEqual(capitalize_string(''), '') # Empty string case def test_is_capitalized(self): - self.assertTrue(is_capitalized('mochi')) + # Test cases for checking if the string is capitalized + self.assertTrue(is_capitalized('Mochi')) + self.assertFalse(is_capitalized('mochi')) # This case should return False + self.assertTrue(is_capitalized('Hello')) + self.assertFalse(is_capitalized('hello')) + self.assertFalse(is_capitalized('')) # Empty string should return False if __name__ == '__main__': unittest.main()