def test_copy_after_map(self): a = Chain(range(3)).map(lambda x: 2 * x) b = a.copy() a.map(lambda x: 3 * x) self.assertEqual(list(a), [0, 6, 12]) self.assertEqual(list(b), [0, 2, 4])
def test_copy(self): a = Chain(range(3)) b = a.copy() a.map(lambda x: 2 * x) self.assertEqual(list(a), [0, 2, 4]) self.assertEqual(list(b), [0, 1, 2])