From ae65579e0049d43b53d42e34d3333cc04deeafe2 Mon Sep 17 00:00:00 2001 From: "thomas.storek" <20579672+tstorek@users.noreply.github.com> Date: Wed, 31 May 2023 15:30:10 +0200 Subject: [PATCH] chore: added missing test For #186 --- tests/models/test_units.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/models/test_units.py b/tests/models/test_units.py index af1cb219..121e77b5 100644 --- a/tests/models/test_units.py +++ b/tests/models/test_units.py @@ -1,7 +1,7 @@ """ Test for filip.models.units """ -from unittest import TestCase +import unittest import functools from filip.models.ngsi_v2.units import \ Unit, \ @@ -11,7 +11,7 @@ load_units -class TestUnitCodes(TestCase): +class TestUnitCodes(unittest.TestCase): def setUp(self): self.units_data = load_units() @@ -101,6 +101,16 @@ def test_unit_validator(self): Returns: None """ + + unit_data = self.unit.copy() + unit_data['name'] = "celcius" + with self.assertRaises(ValueError): + Unit(**unit_data) + + def tearDown(self): + """ + clean up + """ # using garbage collector to clean up all caches import gc gc.collect() @@ -113,8 +123,7 @@ def test_unit_validator(self): for object in objects: object.cache_clear() - unit_data = self.unit.copy() - unit_data['name'] = "celcius" - with self.assertRaises(ValueError): - Unit(**unit_data) +if __name__ == '__main__': + unittest.main() +