def test_destination_locator(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.format = 'locator' locations.destination(42, 240, 'subsquare') expect(stdout.getvalue()) == ( 'Destination from location 1 is IO91ot\n' 'Destination from location 2 is IO91sx\n' )
def test_destination_locator(self, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.format = 'locator' locations.destination(42, 240, 'subsquare') assert capsys.readouterr()[0] == ( 'Destination from location 1 is IO91ot\n' 'Destination from location 2 is IO91sx\n' )
def test_destination(self, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.destination(42, 240, False) stdout = capsys.readouterr()[0] if PY2: stdout = stdout.encode('utf-8') assert stdout == ( "Destination from location 1 is 52°00.90'N, 000°13.26'W\n" "Destination from location 2 is 52°10.08'N, 000°02.40'E\n" )
def test_destination(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.destination(42, 240, False) if PY2: expect(stdout.getvalue()) == ( "Destination from location 1 is 52\xc2\xb000.90'N, 000\xc2\xb013.26'W\n" "Destination from location 2 is 52\xc2\xb010.08'N, 000\xc2\xb002.40'E\n" ) else: expect(stdout.getvalue()) == ( "Destination from location 1 is 52°00.90'N, 000°13.26'W\n" "Destination from location 2 is 52°10.08'N, 000°02.40'E\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_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'