def test_after_returns_None_with_passed_last_Position_in_list(self): pl = PositionalList() # create two nodes with proper references in the container: n1 = PositionalList._Node('foo', pl._header, pl._trailer) n2 = PositionalList._Node('bar', n1, pl._trailer) n1._next = n2 pl._header._next = n1 pl._trailer._prev = n2 p2 = PositionalList.Position(pl, n2) result = pl.after(p2) self.assertIsNone(result)
def test_after_returns_Position_after_passed_Position(self): pl = PositionalList() # create two nodes with proper references in the container: n1 = PositionalList._Node('foo', pl._header, pl._trailer) n2 = PositionalList._Node('bar', n1, pl._trailer) n1._next = n2 pl._header._next = n1 pl._trailer._prev = n2 # # create a position for each respective node: p1 = PositionalList.Position(pl, n1) p2 = PositionalList.Position(pl, n2) result = pl.after(p1) self.assertEqual(result, p2)