예제 #1
0
    def test_make_list_multiple3(self):
        """
        this time the cycles overlap, a few more
        """
        cycle = ((1, 2), (1, 2, 3), (1, 2, 3, 4))
        #(1,3,4)
        l = [2, 1, 3, 0]

        self.assertEqual(l, Perm.make_list(cycle))
예제 #2
0
    def test_make_list_multiple(self):
        """
        test that permutation with multiple cycles is handled properly
        """

        cycle = ((1, 2), (3, 4))
        l = [1, 0, 3, 2]

        self.assertEqual(l, Perm.make_list(cycle))
예제 #3
0
    def test_make_list_multiple2(self):
        """
        this time the cycles overlap
        """
        cycle = ((1, 2), (1, 2, 3))
        #(2,3)
        l = [0, 2, 1]

        self.assertEqual(l, Perm.make_list(cycle))
예제 #4
0
    def test_make_list_identity(self):
        """
        test that identity permutation is handled properly
        """

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

        self.assertEqual(l, Perm.make_list(cycle))
예제 #5
0
    def test_make_list_incoplete(self):
        """
        test that permutation of only some of the elements is handled properly
        """

        cycle = ((4, 5), )
        l = [0, 1, 2, 4, 3]

        self.assertEqual(l, Perm.make_list(cycle))
예제 #6
0
 def test_make_list_multiple3(self):
     """
     this time the cycles overlap, a few more
     """
     cycle = ((1,2), (1,2,3), (1,2,3,4))
     #(1,3,4)
     l = [2,1,3,0]
     
     self.assertEqual(l, Perm.make_list(cycle))
예제 #7
0
    def test_make_list(self):
        """
        test making single cycle into permuted list
        """

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

        self.assertEqual(l, Perm.make_list(cycle))
예제 #8
0
 def test_make_list_multiple2(self):
     """
     this time the cycles overlap
     """
     cycle = ((1,2), (1,2,3))
     #(2,3)
     l = [0,2,1]
     
     self.assertEqual(l, Perm.make_list(cycle))
예제 #9
0
 def test_make_list_multiple(self):
     """
     test that permutation with multiple cycles is handled properly
     """
     
     cycle = ((1,2), (3,4))
     l = [1,0,3,2]
     
     self.assertEqual(l, Perm.make_list(cycle))
예제 #10
0
 def test_make_list_incoplete(self):
     """
     test that permutation of only some of the elements is handled properly
     """
     
     cycle = ((4,5),)
     l = [0,1,2,4,3]
     
     self.assertEqual(l, Perm.make_list(cycle))
예제 #11
0
 def test_make_list_identity(self):
     """
     test that identity permutation is handled properly
     """
     
     cycle = ((1,),)
     l = [0]
     
     self.assertEqual(l, Perm.make_list(cycle))
예제 #12
0
 def test_make_list(self):
     """
     test making single cycle into permuted list
     """
     
     cycle = ((1,2,3),)
     l = [1,2,0]
     
     self.assertEqual(l, Perm.make_list(cycle))