Skip to content

Commit 4991b6b

Browse files
committed
development branch
1 parent ad2be75 commit 4991b6b

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

examples/vehicles/get_vehicles.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ def main(api_key):
99

1010
vehicles = route4me.vehicles
1111
response = vehicles.get_vehicles()
12-
if type(response) == dict and 'errors' in response.keys():
13-
print('. '.join(response.get('errors')))
12+
if isinstance(response, dict) and "errors" in response.keys():
13+
print(". ".join(response.get("errors")))
1414
else:
1515
for vehicle in response:
16-
print('Vehicle ID: {0}\tVehicle Alias: {1}'.format(
17-
vehicle.get('vehicle_id'),
18-
vehicle.get('vehicle_alias')
19-
))
16+
print(
17+
"Vehicle ID: {0}\tVehicle Alias: {1}".format(
18+
vehicle.get("vehicle_id"), vehicle.get("vehicle_alias")
19+
)
20+
)
2021

2122

22-
if __name__ == '__main__':
23-
parser = argparse.ArgumentParser(description='Get Vehicles')
24-
parser.add_argument('--api_key', dest='api_key', help='Route4Me API KEY',
25-
type=str, required=True)
23+
if __name__ == "__main__":
24+
parser = argparse.ArgumentParser(description="Get Vehicles")
25+
parser.add_argument(
26+
"--api_key", dest="api_key", help="Route4Me API KEY", type=str, required=True
27+
)
2628
args = parser.parse_args()
2729
main(args.api_key)

tests/test_optimizations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ def test_tsp_optimization(self):
124124
alias='Verizon Wireless',
125125
time=0
126126
)
127-
response = self.route4me.run_optimization()
128-
self.assertEqual(4, response.get('state'))
127+
self.assertEqual(9, len(optimization.data['addresses']))
129128

130129

131130
if __name__ == '__main__':

0 commit comments

Comments
 (0)