예제 #1
0
 def test_distance_nm(self, stdout):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040'],
                                units='nm')
     locations.verbose = False
     locations.distance()
     # Manually convert to string here to workaround Python 2/3 float
     # formatting differences
     expect(stdout.getvalue()) == str(13.298957431655218) + '\n'
예제 #2
0
 def test_distance_multi(self, stdout):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040',
                                '51.420;-1.500'])
     locations.distance()
     expect(stdout.getvalue()) == (
         'Location 1 to 2 is 24 kilometres\n'
         'Location 2 to 3 is 134 kilometres\n'
         'Total distance is 159 kilometres\n'
     )
예제 #3
0
 def test_distance_multi(self, capsys):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040',
                                 '51.420;-1.500'])
     locations.distance()
     assert capsys.readouterr()[0] == (
         'Location 1 to 2 is 24 kilometres\n'
         'Location 2 to 3 is 134 kilometres\n'
         'Total distance is 159 kilometres\n'
     )
예제 #4
0
 def test_distance_sm(self, stdout):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040'],
                                units='sm')
     locations.distance()
     expect(stdout.getvalue()) == 'Location 1 to 2 is 15 miles\n'
예제 #5
0
 def test_distance(self, stdout):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040'])
     locations.distance()
     expect(stdout.getvalue()) == 'Location 1 to 2 is 24 kilometres\n'
예제 #6
0
 def test_distance(self, units, result, capsys):
     locations = NumberedPoints(['52.015;-0.221', '52.168;0.040'],
                                units=units)
     locations.distance()
     assert capsys.readouterr()[0] == 'Location 1 to 2 is %s\n' % result