aboutsummaryrefslogtreecommitdiff
path: root/tests/test_types.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2020-10-02 09:19:34 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2020-10-02 09:19:34 +0200
commit67493bb361e738f376c26b443be4175746b008ec (patch)
tree707acf572eeca5be0b27a2ddcfcd51cdf8100d97 /tests/test_types.py
parentb75c00bf5a7f650ff53a407b47a96407ac277d8e (diff)
More types
Diffstat (limited to 'tests/test_types.py')
-rw-r--r--tests/test_types.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_types.py b/tests/test_types.py
index 2d6b744..f27089d 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -209,6 +209,50 @@ class testTypes(unittest.TestCase):
v = checker.load(None)
self.assertEqual(v, None)
+ def test_file(self):
+ checker = types.LesanaFile()
+
+ v = checker.empty()
+ self.assertEqual(v, "")
+
+ v = checker.load("relative/path/to/file")
+ self.assertEqual(v, "relative/path/to/file")
+
+ v = checker.load(None)
+ self.assertEqual(v, None)
+
+ # TODO: check for invalid file paths
+
+ def test_url(self):
+ checker = types.LesanaURL()
+
+ v = checker.empty()
+ self.assertEqual(v, "")
+
+ v = checker.load("http://example.org")
+ self.assertEqual(v, "http://example.org")
+
+ v = checker.load(None)
+ self.assertEqual(v, None)
+
+ # TODO: check for invalid URLs
+
+ def test_yaml(self):
+ checker = types.LesanaYAML()
+
+ v = checker.empty()
+ self.assertEqual(v, None)
+
+ some_data = {
+ 'anything': 'goes',
+ 'everything': 42
+ }
+ v = checker.load(some_data)
+ self.assertEqual(v, some_data)
+
+ v = checker.load(None)
+ self.assertEqual(v, None)
+
if __name__ == '__main__':
unittest.main()