コード例 #1
0
def test_value_error():
    with pytest.raises(TypeError):
        distance(None)
コード例 #2
0
def test_typical():
    assert round(distance(2, 3, 10, 8), 4) == 9.434
コード例 #3
0
def test_type_error():
    with pytest.raises(TypeError):
        distance('aoeu')
コード例 #4
0
def test_order():
    assert distance(1, 2, 3, 4) == distance(3, 4, 1, 2)
コード例 #5
0
def test_horizontal_distance():
    assert distance(0, 0, 10, 0) == 10
コード例 #6
0
def test_vertical_distance():
    assert distance(0, 5, 0, 0) == 5
コード例 #7
0
def test_negative_coordinates():
    assert round(distance(-2, -3, -10, 8), 4) == 13.6015
コード例 #8
0
def test_zero_length():
    assert distance(1, 1, 1, 1) == 0