Пример #1
0
    def test_make_cycle_unmoved(self):
        """
        test that unmoved elements are dropped
        """
        l = [0, 1, 3, 2]
        cycles = ((3, 4), )

        self.assertEqual(cycles, Perm.make_cycles(l))
Пример #2
0
    def test_make_cycle_unmoved(self):
        """
        test that unmoved elements are dropped
        """
        l = [0,1,3,2]
        cycles = ((3,4),)

        self.assertEqual(cycles, Perm.make_cycles(l))
Пример #3
0
    def test_make_cycle_double(self):
        """
        test with multiple cycles
        """
        l = [1, 0, 3, 2]
        cycles = ((1, 2), (3, 4))

        self.assertEqual(cycles, Perm.make_cycles(l))
Пример #4
0
 def test_make_cycle_double(self):
     """
     test with multiple cycles
     """
     l = [1,0,3,2]
     cycles = ((1,2),(3,4))
     
     self.assertEqual(cycles, Perm.make_cycles(l))
Пример #5
0
    def test_make_cycle_identity(self):
        """
        test the cycle maker on the identity permutation
        """

        l = [0]
        cycles = ((1, ), )

        self.assertEqual(cycles, Perm.make_cycles(l))
Пример #6
0
    def test_make_cycle(self):
        """
        test turning a permuted list into its list representation
        """

        cycles = ((1, 2, 3), )
        l = [1, 2, 0]

        self.assertEqual(cycles, Perm.make_cycles(l))
Пример #7
0
 def test_make_cycle_identity(self):
     """
     test the cycle maker on the identity permutation
     """
     
     l = [0]
     cycles = ((1,),)
     
     self.assertEqual(cycles, Perm.make_cycles(l))
Пример #8
0
 def test_make_cycle(self):
     """
     test turning a permuted list into its list representation
     """
     
     cycles = ((1,2,3),)
     l = [1,2,0]
     
     self.assertEqual(cycles, Perm.make_cycles(l))