diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-10-05 08:15:18 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-10-05 08:21:08 +0200 |
commit | 7e0061b4d99e8a23734bdd6d9a83942eb73c5793 (patch) | |
tree | 44e52ed1a96995f73d82482c4eb6fbad85b828b5 /tests/test_types.py | |
parent | 3dcb6e8be1c2b6048cfc908cb3a6bd324356c57e (diff) |
Start testing lesana derivatives
Diffstat (limited to 'tests/test_types.py')
-rw-r--r-- | tests/test_types.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/test_types.py b/tests/test_types.py index f27089d..363d9a4 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -12,8 +12,14 @@ class testTypes(unittest.TestCase): def tearDown(self): pass + def _get_field_def(self, type_name): + return { + 'type': type_name, + 'name': 'test_field', + } + def test_base(self): - checker = types.LesanaType() + checker = types.LesanaType(self._get_field_def('base')) # The base class does not implement empty nor load with self.assertRaises(NotImplementedError): @@ -23,7 +29,7 @@ class testTypes(unittest.TestCase): checker.load("") def test_string(self): - checker = types.LesanaString() + checker = types.LesanaString(self._get_field_def('string')) s = checker.empty() self.assertEqual(s, "") @@ -35,7 +41,7 @@ class testTypes(unittest.TestCase): self.assertEqual(s, None) def test_text(self): - checker = types.LesanaText() + checker = types.LesanaText(self._get_field_def('text')) s = checker.empty() self.assertEqual(s, "") @@ -47,7 +53,7 @@ class testTypes(unittest.TestCase): self.assertEqual(s, None) def test_int(self): - checker = types.LesanaInt() + checker = types.LesanaInt(self._get_field_def('integer')) v = checker.empty() self.assertEqual(v, 0) @@ -66,7 +72,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_float(self): - checker = types.LesanaFloat() + checker = types.LesanaFloat(self._get_field_def('float')) v = checker.empty() self.assertEqual(v, 0.0) @@ -88,7 +94,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_decimal(self): - checker = types.LesanaDecimal() + checker = types.LesanaDecimal(self._get_field_def('decimal')) v = checker.empty() self.assertEqual(v, decimal.Decimal(0)) @@ -110,7 +116,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_timestamp(self): - checker = types.LesanaTimestamp() + checker = types.LesanaTimestamp(self._get_field_def('timestamp')) v = checker.empty() self.assertEqual(v, None) @@ -136,7 +142,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_datetime(self): - checker = types.LesanaDatetime() + checker = types.LesanaDatetime(self._get_field_def('datetime')) v = checker.empty() self.assertEqual(v, None) @@ -165,7 +171,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_date(self): - checker = types.LesanaDate() + checker = types.LesanaDate(self._get_field_def('date')) v = checker.empty() self.assertEqual(v, None) @@ -194,7 +200,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_boolean(self): - checker = types.LesanaBoolean() + checker = types.LesanaBoolean(self._get_field_def('boolean')) v = checker.empty() self.assertEqual(v, None) @@ -210,7 +216,7 @@ class testTypes(unittest.TestCase): self.assertEqual(v, None) def test_file(self): - checker = types.LesanaFile() + checker = types.LesanaFile(self._get_field_def('file')) v = checker.empty() self.assertEqual(v, "") @@ -224,7 +230,7 @@ class testTypes(unittest.TestCase): # TODO: check for invalid file paths def test_url(self): - checker = types.LesanaURL() + checker = types.LesanaURL(self._get_field_def('url')) v = checker.empty() self.assertEqual(v, "") @@ -238,7 +244,7 @@ class testTypes(unittest.TestCase): # TODO: check for invalid URLs def test_yaml(self): - checker = types.LesanaYAML() + checker = types.LesanaYAML(self._get_field_def('yaml')) v = checker.empty() self.assertEqual(v, None) |