コード例 #1
0
    def test_make_position_returns_None_with_sentinel_node_parameter(self):
        pl = PositionalList()
        header_node = pl._header
        trailer_node = pl._trailer

        result_header = pl._make_position(header_node)
        result_trailer = pl._make_position(trailer_node)

        self.assertIsNone(result_header)
        self.assertIsNone(result_trailer)
コード例 #2
0
    def test_make_position_returns_Position_instance_for_given_node(self):
        pl = PositionalList()
        n = PositionalList._Node('foo', pl._header, pl._trailer)
        pl._header._next = n
        pl._trailer._prev = n
        expected_position = PositionalList.Position(pl, n)

        result_position = pl._make_position(n)

        #  comparing the instances done using the Position's __eq__ method
        self.assertEqual(result_position, expected_position)