#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest # pretend you wrote the string library for a moment: class TestStringMethods(unittest.TestCase): # Returns True if the string contains 4 a. def test_strings_a(self) -> None: self.assertEqual("a" * 4, "aaaa") # Returns True if the string is in upper case. def test_upper(self) -> None: self.assertEqual("foo".upper(), "FOO") # Returns TRUE if the string is in uppercase # else returns False. def test_isupper(self) -> None: self.assertTrue("FOO".isupper()) self.assertFalse("Foo".isupper()) # Returns true if the string splits and matches # the given output. def test_split(self) -> None: s = "hello world" self.assertEqual(s.split(), ["hello", "world"]) if __name__ == "__main__": unittest.main(verbosity=2)