From 67493bb361e738f376c26b443be4175746b008ec Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 2 Oct 2020 09:19:34 +0200 Subject: More types --- tests/test_types.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests') 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() -- cgit v1.2.3