Esempio n. 1
0
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)
Esempio n. 2
0
def test_to_osgb36_arthurs_seat_example():
    x, y = bng.to_osgb36('NT2755072950')
    assert (x, y) == (327550, 672950)
Esempio n. 3
0
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)
Esempio n. 4
0
def test_to_osgb36_calculates_correct_offset(gridref, expected):
    coords = bng.to_osgb36(gridref)
    assert coords[:2] == expected[:2]
Esempio n. 5
0
def test_to_osgb36_handles_lower_case_input():
    coords = bng.to_osgb36('sv0101')
    assert coords == (1000, 1000)
Esempio n. 6
0
def test_to_osgb36_expands_figures_correctly(gridref, expected):
    # Test covers numbers below and over 5
    coords = bng.to_osgb36(gridref)
    assert coords == expected
Esempio n. 7
0
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)