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 authored and djs0109 committed Jun 1, 2023
1 parent 9a90df5 commit c39fb21
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 @@ -109,6 +109,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 @@ -121,8 +131,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 c39fb21

Please sign in to comment.