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