Skip to content

Commit

Permalink
chore: added missing test
Browse files Browse the repository at this point in the history
For #186
  • Loading branch information
tstorek committed May 31, 2023
1 parent 4c2d94b commit ae65579
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/models/test_units.py
Original file line number Diff line number Diff line change
@@ -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, \
Expand All @@ -11,7 +11,7 @@
load_units


class TestUnitCodes(TestCase):
class TestUnitCodes(unittest.TestCase):

def setUp(self):
self.units_data = load_units()
Expand Down Expand Up @@ -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()
Expand All @@ -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()


0 comments on commit ae65579

Please sign in to comment.