Beispiel #1
0
class TestStringUtility(unittest.TestCase):
    def setUp(self):
        self.stringUtil = StringUtility()

    def test_reverse(self):
        self.assertEqual(self.stringUtil.reverse("Test String"), "gnirtS tseT")
        self.assertEqual(self.stringUtil.reverse("Otto"), "ottO")
        self.assertEqual(self.stringUtil.reverse(""), "")
        self.assertEqual(self.stringUtil.reverse("  "), "  ")

    def test_char_frequency(self):
        self.assertEqual(self.stringUtil.char_frequency("Test String", "t"), 2)

    def test_is_palindrone(self):
        self.assertTrue(self.stringUtil.is_palindrone("otto"))
class TestStringUtility(unittest.TestCase):
    
    def setUp(self):
        self.stringUtil = StringUtility()
    
    def test_reverse(self):
        self.assertEqual(self.stringUtil.reverse("Test String"), "gnirtS tseT")
        self.assertEqual(self.stringUtil.reverse("Otto"), "ottO")
        self.assertEqual(self.stringUtil.reverse(""), "")
        self.assertEqual(self.stringUtil.reverse("  "), "  ")
        
    def test_char_frequency(self):
        self.assertEqual(self.stringUtil.char_frequency("Test String", "t"), 2)
        
    def test_is_palindrone(self):
        self.assertTrue(self.stringUtil.is_palindrone("otto"))
Beispiel #3
0
 def setUp(self):
     self.stringUtil = StringUtility()
 def setUp(self):
     self.stringUtil = StringUtility()