def test_display_non_verbose(self, capsys): locs = NumberedPoints(['Home', '52.168;0.040'], config_locations={'Home': (52.015, -0.221)}) locs.format = 'locator' locs.verbose = False locs.display('extsquare') assert capsys.readouterr()[0] == 'IO92va33\nJO02ae40\n'
def test_display_non_verbose(self, stdout): locs = NumberedPoints(['Home', '52.168;0.040'], config_locations={'Home': (52.015, -0.221)}) locs.format = 'locator' locs.verbose = False locs.display('extsquare') expect(stdout.getvalue()) == 'IO92va33\nJO02ae40\n'
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'
def test_destination_locator_non_verbose(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.format = 'locator' locations.verbose = False locations.destination(42, 240, 'extsquare') expect(stdout.getvalue()) == 'IO91ot97\nIO91sx14\n'
def test_range_non_verbose(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.verbose = False locations.range(30) expect(stdout.getvalue()) == 'True\n'
def test_final_bearing_non_verbose(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.verbose = False locations.bearing('final_bearing', True) expect(stdout.getvalue()) == 'North-east\n'
def test_destination_locator_non_verbose(self, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.format = 'locator' locations.verbose = False locations.destination(42, 240, 'extsquare') assert capsys.readouterr()[0] == 'IO91ot97\nIO91sx14\n'
def test_range_non_verbose(self, distance, result, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.verbose = False locations.range(distance) assert capsys.readouterr()[0] == result + '\n'
def test_final_bearing_non_verbose(self, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.verbose = False locations.bearing('final_bearing', True) assert capsys.readouterr()[0] == 'North-east\n'