def test_all_dec_coordinates():
    expected = (46. + (50. / 60.) + (12. / 3600.))

    for coord_value in [
            '46 50 12',
            '46:50:12',
            '+46 50 12',
            (46. + (50. / 60.) + (12. / 3600.)),
            ]:
        assert Coordinate.sanitise_dec(coord_value) == expected
def test_negative_dec_coordinate():
    expected = -(46. + (50. / 60.) + (12. / 3600.))
    assert Coordinate.sanitise_dec('-46 50 12') == expected
def test_bad_dec_coordinate(coordinate):
    coordinate.dec = "thisisatest"
    with pytest.raises(CannotParseCoordinate) as err:
        Coordinate.sanitise_dec(coordinate.dec)
def test_dec_to_coordinate(coordinate):
    expected = (46. + (50. / 60.) + (12. / 3600.))
    assert Coordinate.sanitise_dec(coordinate.dec) == expected