class TestUnitaire_Sommet(unittest.TestCase): premierSommet = Sommet('a', 200, 300, False) def setUp(self): self.premierSommet = Sommet('a', 200, 300, False) def tearDown(self): pass def test_recupererIdRetourneLeBonId(self): self.assertEqual(self.premierSommet.recupererId(), 'a') def test_recupererDistanceRetourneLaBonneDistance(self): self.premierSommet.assignerDistance(6) distance = self.premierSommet.recupererDistance() self.assertEqual(distance, 6) def test_recupererConnectionRetourneTousLesNoeudsAdjacents(self): noeudsAdjacents = self.premierSommet.adjacent = {'b': (300, 400), 'c': (400, 500), 'd': (500, 600)} self.assertEqual(self.premierSommet.recupererConnection(), noeudsAdjacents.keys()) def test_aEteVisiteChangeLeParametreVisiteEnTrue(self): self.premierSommet.aEteVisite() self.assertTrue(self.premierSommet.visite) def test_assignerPrecedentChangeLeParametrePrecedentDuNoeud(self): self.premierSommet.assignerPrecedent('p') self.assertEqual(self.premierSommet.precedent, 'p')
def setUp(self): self.premierSommet = Sommet('a', 200, 300, False)