コード例 #1
0
 def test_type_error_when_none(self):
     with pytest.raises(TypeError):
         lenght_of_segment.distance(None)
コード例 #2
0
 def test_only_horizontal(self):
     self.assertEquals(lenght_of_segment.distance(1, 3, 4, 3), 3)
コード例 #3
0
 def test_only_vertical(self):
     self.assertEquals(lenght_of_segment.distance(0, 5, 0, 7), 2)
コード例 #4
0
 def test_negative_coordinates(self):
     self.assertEquals(lenght_of_segment.distance(-1, -1, -3, -5),
                       4.47213595499958)
コード例 #5
0
 def test_zero_distance(self):
     self.assertEquals(lenght_of_segment.distance(3, 3, 3, 3), 0)
コード例 #6
0
 def test_value_error_when_aoeu(self):
     with pytest.raises(TypeError):
         lenght_of_segment.distance("aoeu", 2, 2, 2)