def test_make_directions_links(self): D, Ar, pr = fdr.make_distance_matrix(self.As, self.p) R = fdr.find_routes(D, Ar, pr) S = fdr.make_directions_links(R) self.assertIsInstance(S, dict) self.assertTrue(all([v[1].split('\n')[0] == self.As[0][0]\ + ' ' + self.As[0][1] for v in S.values()]))
def test_optimize_waypoints(self): D, Ar, pr = fdr.make_distance_matrix(self.As, self.p) R = fdr.naive_find_routes(D, Ar, pr) O = fdr.optimize_waypoints(R) self.assertIsInstance(O, dict) self.assertTrue(O[1]['route_address'][1][0] == 'Ritual Coffee') self.assertTrue(O[1]['route_address'][2][0] == 'Freewheel Bike Shop')
def test_naive_find_routes(self): D, Ar, pr = fdr.make_distance_matrix(self.As, self.p) R = fdr.naive_find_routes(D, Ar, pr) self.assertIsInstance(R, dict) self.assertTrue( any(['Flywheel' in a[0] for a in R[0]['route_address']])) self.assertTrue(any(['Ritual' in a[0] for a in R[1]['route_address']])) self.assertTrue('Arsicault' in [v['name'] for v in R.values()]) self.assertTrue('La Boulangerie' in [v['name'] for v in R.values()])
def test_make_distance_matrix(self): Dr, Ar, pr = fdr.make_distance_matrix(self.As, self.p) self.assertEqual(self.At, Ar) self.assertEqual([4, 5], pr) self.assertEqual(self.Dc, Dr)