def test_convert_spatial(converter):
LocationFactory(
url="http://www.yso.fi/onto/yso/p508763",
pref_label={"fi": "Alppikylä (Helsinki)", "sv": "Alpbyn (Helsingfors)"},
in_scheme="http://www.yso.fi/onto/yso/places",
as_wkt="POINT (25.06677 60.25873)",
)
# as_wkt matches place_uri location, omit from custom_wkt
spatial = converter.convert_spatial(
{
"place_uri": {
"identifier": "http://www.yso.fi/onto/yso/p508763",
},
"as_wkt": ["POINT (25.06677 60.25873)"],
}
)
assert spatial["reference"]["pref_label"]["fi"] == "Alppikylä (Helsinki)"
assert spatial["custom_wkt"] == None
# as_wkt does not match place_uri location, keep in custom_wkt
spatial = converter.convert_spatial(
{
"place_uri": {
"identifier": "http://www.yso.fi/onto/yso/p508763",
},
"as_wkt": ["POINT (27.06677 -30.25873)"],
}
)
assert spatial["reference"]["pref_label"]["fi"] == "Alppikylä (Helsinki)"
assert spatial["custom_wkt"] == ["POINT (27.06677 -30.25873)"]