コード例 #1
0
 def test_distance_from_thimoteo_to_lopes(self):
     erdometer = Erdometer()
     erdometer.add('Erdos', 'Lopes')
     erdometer.add('Lopes', 'Carvalho')
     erdometer.add('Carvalho', 'Abreu')
     erdometer.add('Abreu', 'Thimoteo')
     erdometer.add('Thimoteo', 'Erdos')
     self.assertEqual(2, erdometer.distance('Thimoteo', 'Lopes'))
コード例 #2
0
 def test_distance_from_lopes(self):
     erdometer = Erdometer()
     erdometer.add('Erdos', 'Lopes')
     self.assertEqual(1, erdometer.distance('Lopes'))
コード例 #3
0
 def test_distance_from_bernardes(self):
     erdometer = Erdometer()
     erdometer.add('Erdos', 'Lopes')
     erdometer.add('Bernardes', 'Carvalho')
     self.assertEqual(None, erdometer.distance('Bernardes'))
コード例 #4
0
 def test_distance_from_abreu(self):
     erdometer = Erdometer()
     erdometer.add('Erdos', 'Lopes')
     erdometer.add('Lopes', 'Carvalho')
     erdometer.add('Carvalho', 'Abreu')
     self.assertEqual(3, erdometer.distance('Abreu'))
コード例 #5
0
 def test_distance_from_carvalho(self):
     erdometer = Erdometer()
     erdometer.add('Erdos', 'Lopes')
     erdometer.add('Lopes', 'Carvalho')
     self.assertEqual(2, erdometer.distance('Carvalho'))