Пример #1
0
    def test_case_1(self):
        words = []
        expected = []
        output = list(
            map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)
Пример #2
0
    def test_case_8(self):
        words = ["abc", "abe", "abf", "abg"]
        expected = [["abc"], ["abe"], ["abf"], ["abg"]]
        output = list(
            map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)
Пример #3
0
    def test_case_5(self):
        words = ["zxc", "asd", "weq", "sda", "qwe", "xcz"]
        expected = [["zxc", "xcz"], ["asd", "sda"], ["qwe", "weq"]]
        output = list(
            map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)
Пример #4
0
    def test_case_4(self):
        words = ["abc", "cba", "bca"]
        expected = [["abc", "cba", "bca"]]
        output = list(
            map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)
Пример #5
0
    def test_case_7(self):
        words = ["cinema", "a", "flop", "iceman", "meacyne", "lofp", "olfp"]
        expected = [["cinema", "iceman"], ["flop", "lofp", "olfp"], ["a"],
                    ["meacyne"]]
        output = list(map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)
Пример #6
0
    def test_case_6(self):
        words = ["yo", "act", "flop", "tac", "cat", "oy", "olfp"]
        expected = [["yo", "oy"], ["flop", "olfp"],
                    ["act", "tac", "cat"]]
        output = list(
            map(lambda x: sorted(x), program.groupAnagrams(words)))

        compare(self, expected, output)