def test_range(self, distance, result, capsys): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.range(distance) stdout = capsys.readouterr()[0] if result is True: assert 'is within' in stdout else: assert 'is not within' in stdout
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_range2(self, stdout): locations = NumberedPoints(['52.015;-0.221', '52.168;0.040']) locations.range(30) expect(stdout.getvalue()) == \ 'Location 2 is within 30 kilometres of location 1\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'