def test_only_horizontal_distance():
    assert distance(1, 0, 4, 0) == 3.0
 def test_typical(self):
     self.assertEqual(distance(1, 2, 3, 4), 2.8284271247461903)
 def test_none(self):
     with self.assertRaises(TypeError):
         distance(None, None, None, None)
 def test_zero(self):
     self.assertEqual(distance(1, 1, 1, 1), 0)
 def test_vertical(self):
     self.assertEqual(distance(1, 1, 1, 2), 1)
示例#6
0
def test_eval(test_input, expected):
    assert distance(*test_input) == expected
示例#7
0
def test_aoeu_input():
    with pytest.raises(TypeError):
        distance('aoeu', 'aoeu', 'aoeu', 'aoeu')
示例#8
0
def test_only_vertical_distance():
    assert distance(1, 1, 1, 2) == 1.0
示例#9
0
def test_only_horizontal_distance():
    assert distance(1, 1, 2, 1) == 1.0
def test_crash_with_value_error_on_aoeu():
    with pytest.raises(ValueError):
        distance('aoeu', 'aoeu', 'aoeu', 'aoeu')
示例#11
0
def test_negative():
    assert distance(-1, -1, -1, -1) == 0.0
def test_crash_with_type_error_on_none():
    with pytest.raises(TypeError):
        distance(None, None, None, None)
def test_order_does_not_matter():
    assert distance(4, -3, -5, 2) == distance(-5, 2, 4, -3)
def test_typical_conditions():
    assert distance(2, 6, 4, -9) == 15.132745950421556
示例#15
0
def test_horizontal_only():
    assert distance(1, 0, 6, 0) == 5
示例#16
0
def test_typical_conditions():
    assert distance(3, 5, 7, 9) == 5.656854249492381
示例#17
0
def test_typical_points():
    assert distance(4, 5, 1, 1) == 5
示例#18
0
def test_order_does_not_matter():
    assert distance(3, 5, 7, 9) == distance(7, 9, 3, 5)
示例#19
0
def test_none_input():
    with pytest.raises(TypeError):
        distance(None, None, None, None)
示例#20
0
def test_type_error_none():
    with pytest.raises(TypeError):
        distance(None, None, None, None)
示例#21
0
def test_if_order_of_points_matters():
    assert distance(1, 2, 3, 4) == distance(4, 3, 2, 1)
示例#22
0
def test_value_error_string():
    with pytest.raises(TypeError):
        distance('aoeu', 'aoeu', 'aoeu', 'aoeu')
 def test_negative(self):
     self.assertEqual(distance(-1, -1, -2, -2), 1.4142135623730951)
示例#24
0
def test_zero_length():
    assert distance(1, 1, 1, 1) == 0
 def test_horizontal(self):
     self.assertEqual(distance(1, 1, 2, 1), 1)
示例#26
0
def test_negative_values():
    assert distance(-3, -4, 0, 0) == 5
 def test_order(self):
     self.assertEqual(distance(1, 0, 1, 0), distance(0, 1, 0, 1))
示例#28
0
def test_vertical_only():
    assert distance(0, 1, 0, 6) == 5
 def test_string(self):
     with self.assertRaises(TypeError):
         distance('aeou', 'aeou', 'aeou', 'aeou')
def test_only_vertical_distance():
    assert distance(0, 1, 0, 4) == 3.0