def test_total(self): foo = "abbcccc" foo = set(Solution.swaps(foo)) bar = "bcccbac" bar = set(Solution.swaps(bar)) pass
def test_normalize(self): s = Solution("gzhhg") s.normalize() self.assertEqual(s.sorted_key, "abbcc") self.assertEqual(s.norm_str, "baccb") self.assertEqual(s.mid_c, 'a')
def test_sameness(self): l = list(Solution.same_of("abcdabcd")) s = set(l) self.assertEqual(len(l), len(s))
def test_swaps(self): swaps = list(Solution.swaps("cdbbaadc")) self.assertEqual(28, len(swaps))
def test_is_palindrom(self): self.assertTrue(Solution.is_palindom("bab")) self.assertFalse(Solution.is_palindom("abb"))