summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-02-20 11:18:13 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-02-20 11:18:13 +0100
commited8b6ad28bacca1db642fa1855ebb7c5f882307e (patch)
tree0de92d5f13424ec5a0dc31711c73b0863318c1fe /tests
parent85df20f3644349aa2eaa0b9c7748d960561098a2 (diff)
New data type: geo (for Geo URIs)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_types.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_types.py b/tests/test_types.py
index 32340d5..21a6d52 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -415,6 +415,26 @@ class testTypes(unittest.TestCase):
v = checker.auto("http://example.org")
self.assertEqual(v, "http://example.org")
+ def test_geo(self):
+ checker = types.LesanaGeo(self._get_field_def('geo'), {})
+
+ v = checker.empty()
+ self.assertEqual(v, "")
+
+ v = checker.load("geo:45.81483,9.07524?z=17")
+ self.assertEqual(v, "geo:45.81483,9.07524?z=17")
+
+ v = checker.load(None)
+ self.assertEqual(v, None)
+
+ # TODO: improve check for invalid Geo URIs
+ for u in ("http://example.org",):
+ with self.assertRaises(types.LesanaValueError):
+ checker.load(u)
+
+ v = checker.auto("geo:45.81483,9.07524?z=17")
+ self.assertEqual(v, "geo:45.81483,9.07524?z=17")
+
def test_yaml(self):
checker = types.LesanaYAML(self._get_field_def('yaml'), {})