diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_types.py | 20 |
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'), {}) |