Exemple #1
0
    def test_get_distance_x(self):
        point_1 = (1, 0)
        point_2 = (1, 1)
        length = picture_cross.get_distance(point_1, point_2)
        self.assertEqual(length, 1)

        length = picture_cross.get_distance(point_2, point_1)
        self.assertEqual(length, 1)
Exemple #2
0
 def test_get_distance_assert_length_error(self):
     point_1 = (1, 0, 0)
     point_2 = (1, 1)
     with self.assertRaises(ValueError):
         picture_cross.get_distance(point_1, point_2)
     point_1 = (1, 1)
     point_2 = (1, 0, 0)
     with self.assertRaises(ValueError):
         picture_cross.get_distance(point_1, point_2)
Exemple #3
0
 def test_get_distance_assert_type_error(self):
     point_1 = "hallo"
     point_2 = "ichbi"
     with self.assertRaises(TypeError):
         picture_cross.get_distance(point_1, point_2)
Exemple #4
0
 def test_get_distance_3d(self):
     point_1 = (7, 4, 3)
     point_2 = (17, 6, 2)
     length = picture_cross.get_distance(point_1, point_2)
     self.assertAlmostEqual(length, 10.246951, places=5)
Exemple #5
0
 def test_get_distance_basic(self):
     point_1 = (1.5, 3.1)
     point_2 = (3.3, 4.1)
     length = picture_cross.get_distance(point_1, point_2)
     self.assertAlmostEqual(length, 2.059126)