def Derniertest(self):
     self.assertAlmostEqual(distance_euclidienne((0,1)(1,0)),sqrt(2))
 def QuatrièmeTest(self):
     ab = distance_euclidienne(point_a,point_b)
     ac = distance_euclidienne(point_a,point_c)
     bc = distance_euclidienne(point_b,point_c)
     somme = ab + bc
     self.assertLessEqual(ac,somme)
 def TroisèmeTest(self):
     self.assertEqual(distance_euclidienne(point_a,point_b),distance_euclidienne(point_b,point_a))
 def DeuxièmeTest(self):
     self.assertGreaterEqual(distance_euclidienne(point_a,point_b),0)
 def PermierTest(self):
     self.assertEqual( 0,distance_euclidienne(point_a,point_a))
Exemplo n.º 6
0
# Créé par souss, le 24/04/2021 en Python 3.7
import numpy as np
from projet import distance_euclidienne
from random import randint

Bilan = True

point_a = np.array((randint(0, 10000), randint(0, 10000)))
point_b = np.array((randint(0, 10000), randint(0, 10000)))
point_c = np.array((randint(0, 10000), randint(0, 10000)))
if distance_euclidienne(point_a, point_a) == 0:
    Bilan = True
else:
    Bilan = False
if Bilan == False:
    print("echec du test")

if distance_euclidienne(point_b, point_b) == 0:
    Bilan = True
else:
    Bilan = False
if Bilan == False:
    print("echec du test")

if distance_euclidienne(
        point_a, point_b) == 0 or distance_euclidienne(point_a, point_b) > 0:
    Bilan = True
else:
    Bilan = False
if Bilan == False:
    print("echec du test")