Example #1
0
 def test_pop_and_insert_1(self):
     expected = CircularList().from_iterable([1, 2, 3, 4, 5, 6, 7, 8, 9])
     actual = CircularList().from_iterable([9, 2, 3, 4, 5, 6, 7, 8, 1])
     actual.rotate(-8)
     popped = actual.pop_at()
     actual.insert_at_cursor(popped)
     self.assertEqual(expected, actual)
Example #2
0
 def test_rotate_insert_rotate_back_3(self):
     expected = CircularList().from_iterable([1, 2, 3, 4, 5, 6, 7, 8, 9])
     actual = CircularList().from_iterable([1, 2, 3, 4, 5, 6, 7, 9])
     actual.rotate(-6)
     actual.insert_at_cursor(8)
     actual.rotate(7)
     self.assertEqual(expected, actual)
Example #3
0
 def test_rotate_3(self):
     expected = CircularList().from_iterable([2, 3, 4, 0, 1])
     actual = CircularList().from_iterable(range(5))
     actual.rotate(3)
     self.assertEqual(expected, actual)
Example #4
0
 def test_rotate_minus_len(self):
     expected = CircularList().from_iterable([0, 1, 2, 3, 4])
     actual = CircularList().from_iterable(range(5))
     actual.rotate(-len(actual))
     self.assertEqual(expected, actual)
Example #5
0
 def test_type(self):
     self.assertIsInstance(CircularList(), CircularList)
Example #6
0
 def test_rotate_minus_1(self):
     expected = CircularList().from_iterable([1, 2, 3, 4, 0])
     actual = CircularList().from_iterable(range(5))
     actual.rotate(-1)
     self.assertEqual(expected, actual)
Example #7
0
 def test_rotate_2(self):
     expected = CircularList().from_iterable([4, 0, 1, 2, 3])
     actual = CircularList().from_iterable(range(5))
     actual.rotate(1)
     self.assertEqual(expected, actual)
Example #8
0
 def test_rotate_1(self):
     expected = CircularList().from_iterable([4, 0, 1, 2, 3])
     actual = CircularList().from_iterable(range(5))
     actual.rotate()  # test default parameter
     self.assertEqual(expected, actual)
Example #9
0
 def test_equality_empty(self):
     cl1 = CircularList()
     cl2 = CircularList()
     self.assertTrue(cl1 == cl2)
Example #10
0
 def test_len_0(self):
     self.assertEqual(len(CircularList()), 0)