diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-10-01 16:38:13 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-10-01 16:38:13 +0200 |
commit | 83b92c51a863c09946c3da55b0b53490027bf723 (patch) | |
tree | 53222958999df5728607b06cc0b2a1d3e1de75cb /tests | |
parent | 06eeed552b34fb5f60401c1536db3f2cbf868a89 (diff) |
Start using types to validate/load entry fields
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_types.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_types.py b/tests/test_types.py index 907be20..7aff73f 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -20,6 +20,9 @@ class testTypes(unittest.TestCase): s = checker.load("Hello World!") self.assertEqual(s, "Hello World!") + s = checker.load(None) + self.assertEqual(s, None) + def test_text(self): checker = types.LesanaText() @@ -29,6 +32,9 @@ class testTypes(unittest.TestCase): s = checker.load("Hello World!") self.assertEqual(s, "Hello World!") + s = checker.load(None) + self.assertEqual(s, None) + def test_int(self): checker = types.LesanaInt() @@ -45,6 +51,9 @@ class testTypes(unittest.TestCase): with self.assertRaises(types.LesanaValueError): checker.load(d) + v = checker.load(None) + self.assertEqual(v, None) + def test_float(self): checker = types.LesanaFloat() @@ -64,6 +73,9 @@ class testTypes(unittest.TestCase): with self.assertRaises(types.LesanaValueError): checker.load(d) + v = checker.load(None) + self.assertEqual(v, None) + def test_decimal(self): checker = types.LesanaDecimal() @@ -83,6 +95,9 @@ class testTypes(unittest.TestCase): with self.assertRaises(types.LesanaValueError): checker.load(d) + v = checker.load(None) + self.assertEqual(v, None) + if __name__ == '__main__': unittest.main() |