Add tests for creating of PickingParameters object from *args and **kwargs
This commit is contained in:
parent
0230f0bf2e
commit
82c0b7837c
31
tests/test_PickingParameters.py
Normal file
31
tests/test_PickingParameters.py
Normal file
@ -0,0 +1,31 @@
|
||||
import unittest
|
||||
from pylot.core.pick.autopick import PickingParameters
|
||||
|
||||
class TestPickingParameters(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.simple_dict = {'a': 3, 'b': 14}
|
||||
self.nested_dict = {'a': self.simple_dict, 'b': self.simple_dict}
|
||||
|
||||
def assertParameterEquality(self, dic, instance):
|
||||
"""Test wether all parameters given in dic are found in instance"""
|
||||
for key, value in dic.items():
|
||||
self.assertEqual(value, getattr(instance, key))
|
||||
|
||||
def test_add_params_from_dict_simple(self):
|
||||
pickparam = PickingParameters()
|
||||
pickparam.add_params_from_dict(self.simple_dict)
|
||||
self.assertParameterEquality(self.simple_dict, pickparam)
|
||||
|
||||
def test_add_params_from_dict_nested(self):
|
||||
pickparam = PickingParameters()
|
||||
pickparam.add_params_from_dict(self.nested_dict)
|
||||
self.assertParameterEquality(self.nested_dict, pickparam)
|
||||
|
||||
def test_init(self):
|
||||
pickparam = PickingParameters(self.simple_dict)
|
||||
self.assertParameterEquality(self.simple_dict, pickparam)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user