def test_to_osgb36_zipped_example(): gridrefs = ['HU431392', 'SJ637560', 'TV374354'] xy = bng.to_osgb36(gridrefs) x, y = zip(*xy) assert x == (443100, 363700, 537400) assert y == (1139200, 356000, 35400)
def test_to_osgb36_arthurs_seat_example(): x, y = bng.to_osgb36('NT2755072950') assert (x, y) == (327550, 672950)
def test_to_osgb36_throws_bng_error_on_bad_gridref_type(gridref): with pytest.raises(bng.BNGError, match=r'Valid gridref inputs are.*'): bng.to_osgb36(gridref)
def test_to_osgb36_calculates_correct_offset(gridref, expected): coords = bng.to_osgb36(gridref) assert coords[:2] == expected[:2]
def test_to_osgb36_handles_lower_case_input(): coords = bng.to_osgb36('sv0101') assert coords == (1000, 1000)
def test_to_osgb36_expands_figures_correctly(gridref, expected): # Test covers numbers below and over 5 coords = bng.to_osgb36(gridref) assert coords == expected
def test_to_osgb36_throws_bng_error_on_invalid_100km_square(gridref): with pytest.raises(bng.BNGError, match=r'Invalid 100 km grid square.*'): bng.to_osgb36(gridref)