示例#1
0
def test_another_distance():
    from_pos = Position(5, 4)
    to_pos = Position(1, 2)
    expected_distance = 6

    distance = from_pos.distance(to=to_pos)

    assert distance == expected_distance, \
        f"Distance from {from_pos} to {to_pos} was be {distance}, but should be {expected_distance}"
示例#2
0
def test_distance():
    from_pos = Position(0, 0)
    to_pos = Position(1, 1)
    expected_distance = 2

    distance = from_pos.distance(to=to_pos)

    assert distance == expected_distance, \
        f"Distance from {from_pos} to {to_pos} was be {distance}, but should be {expected_distance}"