class TestCase(unittest.TestCase):
    def setUp(self):
        self.solution = Solution()

    def test(self):
        s = 'anagram'
        t = 'nagaram'
        self.assertEqual(self.solution.isAnagram(s, t), True)

    def test2(self):
        s = 'abc'
        t = 'ab'
        self.assertEqual(self.solution.isAnagram(s, t), False)
示例#2
0
class TestCase(unittest.TestCase):
    def setUp(self):
        self.solution = Solution()

    def test(self):
        test_data = [
            {
                's': 'anagram',
                't': 'nagaram',
                'expected': True
            },
            {
                's': 'abc',
                't': 'ab',
                'expected': False
            },
            {
                's': 'cinema',
                't': 'iceman',
                'expected': True
            },
        ]
        for data in test_data:
            s = data['s']
            t = data['t']
            expected = data['expected']
            with self.subTest(s=s, t=t):
                self.assertEqual(self.solution.isAnagram(s, t), expected)
 def setUp(self):
     self.solution = Solution()