コード例 #1
0
def test_only_horizontal_distance():
    assert distance(1, 0, 4, 0) == 3.0
コード例 #2
0
 def test_typical(self):
     self.assertEqual(distance(1, 2, 3, 4), 2.8284271247461903)
コード例 #3
0
 def test_none(self):
     with self.assertRaises(TypeError):
         distance(None, None, None, None)
コード例 #4
0
 def test_zero(self):
     self.assertEqual(distance(1, 1, 1, 1), 0)
コード例 #5
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
コード例 #10
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
コード例 #12
0
def test_crash_with_type_error_on_none():
    with pytest.raises(TypeError):
        distance(None, None, None, None)
コード例 #13
0
def test_order_does_not_matter():
    assert distance(4, -3, -5, 2) == distance(-5, 2, 4, -3)
コード例 #14
0
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')
コード例 #23
0
 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
コード例 #25
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
コード例 #27
0
 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
コード例 #29
0
 def test_string(self):
     with self.assertRaises(TypeError):
         distance('aeou', 'aeou', 'aeou', 'aeou')
コード例 #30
0
def test_only_vertical_distance():
    assert distance(0, 1, 0, 4) == 3.0