Example #1
0
 def test_get_all_combinations_from_leaves(self):
     s = solution(["01", "29"])
     filtered = s.getAllCombinationsFromLeaves()
     assert not CubesPair(Cube([0, 6, 9]), Cube([1, 2])) in filtered
     assert CubesPair(Cube([0, 2]), Cube([1, 6])) in filtered
     assert CubesPair(Cube([0, 2]), Cube([1, 9])) in filtered
     assert CubesPair(Cube([0, 6]), Cube([1, 2])) in filtered
     assert CubesPair(Cube([0, 9]), Cube([1, 2])) in filtered
 def test_cubes_pair_bigger(self):
     assert CubesPair(Cube([1, 2, 3, 4, 5, 7]), Cube(
         [1, 2, 3, 4, 5, 6])) > CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                          Cube([1, 2, 3, 4, 5, 8]))
     assert CubesPair(Cube([1, 2, 3, 4, 5, 6]), Cube(
         [1, 3, 4, 5, 6, 8])) > CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                          Cube([1, 2, 3, 4, 5, 8]))
    def test_tree_set_cubes_pair(self):
        c1 = Cube([0, 4])
        c2 = Cube([0, 4])
        c3 = Cube([])
        c4 = Cube([0, 1, 4])

        t1 = tree(CubesPair(c3, c4))
        t2 = tree(CubesPair(c1, c2))
        t3 = tree(CubesPair(c1, c2))
        t4 = tree(CubesPair(c2, c1))

        a1 = []
        a1.append(t1)
        a1.append(t2)

        a2 = []
        a2.append(t3)
        a2.append(t4)

        assert len(set(a1)) == 2
        assert len(set(a2)) == 1

        t5 = tree(CubesPair(Cube([0, 1, 4]), Cube([0])))
        t6 = tree(CubesPair(Cube([0]), Cube([0, 1, 4])))

        assert len(set([t5, t6])) == 1
Example #4
0
 def test_cube_sizeof(self):
     assert Cube([]).__sizeof__() == 151200
     assert Cube([1]).__sizeof__() == 15120
     assert Cube([1, 2]).__sizeof__() == 1680
     assert Cube([1, 2, 3]).__sizeof__() == 210
     assert Cube([1, 2, 3, 4]).__sizeof__() == 30
     assert Cube([1, 2, 3, 4, 5]).__sizeof__() == 5
Example #5
0
 def test_has_dupes(self):
     assert Cube([1, 1]).hasDupes()
     assert Cube([9, 9]).hasDupes()
Example #6
0
 def test_all_sixninevariants_2(self):
     variants = Cube([6, 9]).allSixNineVariants()
     assert Cube([6, 9]) in variants
Example #7
0
 def test_contains(self):
     assert 3 in Cube([1, 2, 3, 4, 5, 6]).sides
     assert not 7 in Cube([1, 2, 3, 4, 5, 6]).sides
     assert len(Cube([1, 2, 3, 4, 5, 6])) == 6
Example #8
0
 def test_possible_solutions_excluded(self):
     s = solution(solution.SQUARES)
     res = s.getAllCombinations()
     assert not (CubesPair(Cube([1, 2, 4, 8, 9, 9]), Cube(
         [0, 1, 3, 5, 6, 9]))) in res
Example #9
0
 def test_possible_solutions_from_small_set(self):
     s = solution(["01", "29"])
     res = s.getAllCombinations()
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 3, 8,
                                                       9]))) in res
 def test_cubes_pair_equals(self):
     assert CubesPair(Cube([1, 2, 3, 4, 5, 7]),
                      Cube([1, 2, 3, 4, 5,
                            6])) == CubesPair(Cube([1, 2, 3, 4, 5, 7]),
                                              Cube([1, 2, 3, 4, 5, 6]))
     assert CubesPair(Cube([1, 2, 3, 4, 5, 7]),
                      Cube([1, 2, 3, 4, 5,
                            6])) == CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                              Cube([1, 2, 3, 4, 5, 7]))
     assert CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                      Cube([1, 2, 3, 4, 5,
                            7])) == CubesPair(Cube([1, 2, 3, 4, 5, 7]),
                                              Cube([1, 2, 3, 4, 5, 6]))
     assert not CubesPair(Cube([1, 2, 3, 4, 5, 7]), Cube(
         [1, 2, 3, 4, 5, 6])) == CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                           Cube([1, 2, 3, 4, 5, 8]))
     assert CubesPair(Cube([1, 3, 4, 5, 6, 8]),
                      Cube([1, 2, 3, 4, 5,
                            6])) == CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                              Cube([1, 3, 4, 5, 6, 8]))
     assert not CubesPair(Cube([1, 2, 3, 4, 5, 6]), Cube(
         [1, 2, 3, 4, 5, 6])) == CubesPair(Cube([1, 3, 4, 5, 6, 8]),
                                           Cube([1, 2, 3, 4, 5, 6]))
     assert not CubesPair(Cube([1, 3, 4, 5, 6, 8]), Cube(
         [1, 2, 3, 4, 5, 6])) == CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                                           Cube([1, 2, 3, 4, 5, 6]))
     assert CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                      Cube([1, 2, 3, 4, 5,
                            6])).getCubes()[0] == Cube([1, 2, 3, 4, 5, 6])
Example #11
0
 def test_cube_len(self):
     assert len(Cube([3, 4, 5])) == 3
     assert len(Cube([3, 4, 5, None])) == 3
Example #12
0
    def test_cube_less_or_bigger(self):
        assert Cube([1, 2, 3, 4, 5]) < Cube([1, 2, 3, 4, 5, 9])
        assert Cube([1, 2, 3, 4, 5, 0]) < Cube([1, 2, 3, 4, 5, 9])
        assert Cube([1, 2, 3, 4, 5, 0]) > Cube([1, 2, 3, 4, 5])
        assert Cube([]) < Cube([1, 2, 3, 4, 5, 9])

        assert not Cube([]) < Cube([])
        assert not Cube([]) > Cube([])
        assert not Cube([1, 2, 3, 4, 5, 7]) > Cube([1, 2, 3, 4, 5, 7])
        assert not Cube([1, 2, 3, 4, 5, 7]) < Cube([1, 2, 3, 4, 5, 7])
Example #13
0
 def test_cube_has_empty_side(self):
     assert not Cube([1, 2, 3, 4, 5, 0]).hasEmptySide()
     assert Cube([1, 2, 3, 4, 5]).hasEmptySide()
     assert Cube([1, 2, None, 4, 5, 9]).hasEmptySide()
Example #14
0
    def test_cube_equals(self):
        assert Cube([1, 2, 3, 4, 5, 6]) == Cube([1, 2, 3, 4, 5, 6])
        assert Cube([6, 2, 3, 4, 5, 1]) == Cube([1, 2, 3, 4, 5, 6])

        assert not Cube([1, 2, 3, 4, 5, 6]) == Cube([1, 2, 3, 4, 5, 9])
        assert not Cube([1, 2, 3, 4, 5]) == Cube([1, 2, 3, 4, 5, 6])
        assert not Cube([1, 2, 3, 4, 5, 6]) == Cube([1, 2, 3, 4, 5, 9])
        assert not Cube([1, 2, 3, 4, 5, 0]) == Cube([1, 2, 3, 4, 5, 9])
Example #15
0
 def test_possible_solutions(self):
     s = solution(solution.SQUARES)
     res = s.getAllCombinations()
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 3, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 4, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 3, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 4, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 7, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 6, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 3, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 5, 7, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 5, 6, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 4, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 7, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 6, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 5, 6, 9]), Cube([1, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 2, 3, 4, 5,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 3, 4, 5, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 9]), Cube([0, 1, 3, 4, 5,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 9]), Cube([0, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 9]), Cube([1, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 7,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 7,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 7, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 6, 7,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 6, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 3, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 6, 7,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 3, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 5, 6, 7,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 2, 3, 6, 7,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 5, 6, 9]), Cube([1, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([0, 1, 3, 4, 5,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([0, 1, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([0, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([1, 2, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([1, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([1, 3, 4, 5, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 9]), Cube([0, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 9]), Cube([1, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 8, 9]), Cube([0, 3, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 5, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 6, 7,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 6, 7,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 3, 5, 6, 8, 9]), Cube([1, 2, 4, 6, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 5,
                                                       6]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 5, 6, 7, 8, 9]), Cube([1, 2, 3, 4, 5,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 5, 6, 7, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 5, 6, 7, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 5, 6, 7, 8, 9]), Cube([1, 2, 3, 4, 6,
                                                       9]))) in res
Example #16
0
 def test_is_proper_pair(self):
     s = solution(solution.SQUARES)
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 1, 3, 4, 5, 7])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 1, 3, 4, 5, 8])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 3, 4, 5, 8, 9])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 3, 4, 5, 7, 9])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 3, 4, 5, 8, 9])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([0, 1, 3, 4, 5, 7])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([1, 3, 4, 5, 6, 7])))
     assert s.isProperPair(
         CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6, 7])))
     assert s.isProperPair(
         CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6, 7])))
     assert s.isProperPair(
         CubesPair(Cube([0, 1, 2, 3, 4, 5]), Cube([0, 1, 2, 3, 8, 9])))
Example #17
0
 def test_get_all_combinations_from_leaves_exclude(self):
     s = solution(["06", "29"])
     filtered = s.getAllCombinationsFromLeaves()
     assert not CubesPair(Cube([9, 9]), Cube([0, 2])) in filtered
    def test_all_sixnine_variants(self):

        assert CubesPair(Cube([1, 6]), Cube([1, 6])) in CubesPair(
            Cube([1, 6]), Cube([1, 6])).allSixNineVariants()
        assert CubesPair(Cube([1, 9]), Cube([1, 6])) in CubesPair(
            Cube([1, 6]), Cube([1, 6])).allSixNineVariants()
        assert CubesPair(Cube([1, 9]), Cube([1, 9])) in CubesPair(
            Cube([1, 6]), Cube([1, 6])).allSixNineVariants()
        assert CubesPair(Cube([1, 6]), Cube([1, 9])) in CubesPair(
            Cube([1, 6]), Cube([1, 6])).allSixNineVariants()
 def test_cubes_pair_str(self):
     assert str(
         CubesPair(Cube([1, 2, 3, 8, 5, 6]),
                   Cube([1, 2, 3, 6, 5,
                         4]))) == "{[1, 2, 3, 5, 6, 8], [1, 2, 3, 4, 5, 6]}"
 def test_cubes_pair_in(self):
     assert CubesPair(Cube([1, 2, 3]),
                      Cube([1, 2])) in CubesPair(Cube([1, 2]), Cube([1, 2]))
     assert not CubesPair(Cube([4, 5]), Cube([1, 2])) in CubesPair(
         Cube([1, 2]), Cube([1, 2]))
     assert CubesPair(Cube([0, 1, 4]),
                      Cube([0])) in CubesPair(Cube([1, 4]), Cube([0]))
 def test_cubes_unique_in_set(self):
     assert len(
         set([
             CubesPair(Cube([1, 2, 3, 4, 5, 6]), Cube([1, 2, 3, 4, 5, 6])),
             CubesPair(Cube([1, 2, 3, 4, 5, 6]), Cube([1, 2, 3, 4, 5, 6]))
         ])) == 1
     assert len(
         set([
             CubesPair(Cube([1, 2, 3, 4, 5, 6]), Cube([1, 2, 3, 4, 5, 6])),
             CubesPair(Cube([1, 2, 7, 4, 5, 6]), Cube([1, 2, 3, 4, 5, 6]))
         ])) == 2
     assert len(
         set([
             CubesPair(Cube([]), Cube([1, 3, 4, 5, 6, 8])),
             CubesPair(Cube([1, 3, 4, 5, 6, 8]), Cube([]))
         ])) == 1
Example #22
0
 def test_solution_missing(self):
     s = solution(solution.SQUARES)
     res = s.getAllCombinations()
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 1, 3, 4, 5,
                                                       8]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([0, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 3, 4, 5, 7,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 7, 8, 9]), Cube([1, 3, 4, 5, 8,
                                                       9]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([0, 1, 3, 4, 5,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 1, 2, 6, 7, 8]), Cube([1, 3, 4, 5, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       7]))) in res
     assert (CubesPair(Cube([0, 4, 5, 6, 7, 8]), Cube([1, 2, 3, 4, 6,
                                                       7]))) in res
 def test_cubes_pair_length(self):
     assert len(set([Cube([1, 2, 3, 4, 5, 6]),
                     Cube([1, 3, 4, 5, 6, 2])])) == 1
Example #24
0
 def test_cube_in(self):
     assert Cube([1, 2]) in Cube([1, 2, 3, 4])
     assert not Cube([3, 4]) in Cube([1, 2])
     assert not Cube([1, 4]) in Cube([1, 2])
     assert Cube([]) in Cube([1, 2])
     assert not Cube([1, 2]) in Cube([])
     assert Cube([]) in Cube([1, 2])
 def test_cubes_pair_all_variants(self):
     assert CubesPair(Cube([1, 2, 3, 4, 5, 6]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([1, 2, 3, 4, 5]),
                                              Cube([1, 2, 3, 4, 5,
                                                    6])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 7]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([1, 2, 3, 4, 5]),
                                              Cube([1, 2, 3, 4, 5,
                                                    6])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 8]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([1, 2, 3, 4, 5]),
                                              Cube([1, 2, 3, 4, 5,
                                                    6])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 9]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([1, 2, 3, 4, 5]),
                                              Cube([1, 2, 3, 4, 5,
                                                    6])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 9]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([1, 2, 3, 4]),
                                              Cube([1, 2, 3,
                                                    4])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 9]),
                      Cube([1, 2, 3, 4,
                            5, 6])) in CubesPair(Cube([1]),
                                                 Cube([1, 2, 3,
                                                       4])).allVariants()
     assert CubesPair(Cube([1, 2, 3, 4, 5, 9]),
                      Cube([1, 2, 3, 4, 5,
                            6])) in CubesPair(Cube([]),
                                              Cube([])).allVariants()
Example #26
0
    def test_cube_allvariants(self):
        assert Cube([1, 2, 3, 4, 5, 6]) in Cube([1, 2, 3, 4, 5]).allVariants()
        assert Cube([1, 2, 3, 4, 5, 7]) in Cube([1, 2, 3, 4, 5]).allVariants()
        assert Cube([1, 2, 3, 4, 5, 8]) in Cube([1, 2, 3, 4, 5]).allVariants()
        assert Cube([1, 2, 3, 4, 5, 9]) in Cube([1, 2, 3, 4, 5]).allVariants()
        assert Cube([0, 2, 3, 4, 5, 9]) in Cube([]).allVariants()

        assert Cube([0, 1, 3, 4, 5, 7]) in Cube([0, 1, 3, 4, 5]).allVariants()