コード例 #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"))
コード例 #2
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"))
コード例 #3
0
 def setUp(self):
     self.stringUtil = StringUtility()
コード例 #4
0
 def setUp(self):
     self.stringUtil = StringUtility()