From 83b92c51a863c09946c3da55b0b53490027bf723 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 1 Oct 2020 16:38:13 +0200 Subject: Start using types to validate/load entry fields --- tests/test_types.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/test_types.py') 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() -- cgit v1.2.3