def test_str_non_empty(self): cl = CircularList.from_iterable([1, 2, 3]) actual = io.StringIO() with redirect_stdout(actual): print(cl, end='') expected = 'CircularList((1), 2, 3)' self.assertEqual(actual.getvalue(), expected)
def test_equality(self): cl1 = CircularList.from_iterable(range(4)) cl2 = CircularList.from_iterable([0, 1, 2, 3]) self.assertTrue(cl1 == cl2)
def test_truthfulness_2(self): cl = CircularList.from_iterable([1, 2, 5, 8, 9]) self.assertTrue(cl)
def test_truthfulness_1(self): cl = CircularList.from_iterable([-1]) self.assertTrue(cl)
def test_truthfulness_empty_container(self): cl = CircularList.from_iterable([]) self.assertFalse(cl)
def test_from_iterable_2(self): cl = CircularList.from_iterable([1, 2, 5, 8, 9]) self.assertEqual(len(cl), 5)
def test_from_iterable_1(self): cl = CircularList.from_iterable([1]) self.assertEqual(len(cl), 1)
def test_from_iterable_empty(self): cl = CircularList.from_iterable([]) self.assertEqual(len(cl), 0)