Пример #1
0
 def test_deserialize_all_floats(self) -> None:
     data = dict(min_value=33.3, max_value=44, default_value=41.1, name='foo')
     declaration = ParameterDeclaration.deserialize(self.serializer, **data)
     self.assertEqual(data['min_value'], declaration.min_value)
     self.assertEqual(data['max_value'], declaration.max_value)
     self.assertEqual(data['default_value'], declaration.default_value)
     self.assertEqual(data['name'], declaration.name)
     self.assertIsNone(declaration.identifier)
Пример #2
0
 def test_deserialize_min_max_references(self) -> None:
     data = dict(min_value='bar_min', max_value='bar_max', default_value=-23.5, name='foo')
     declaration = ParameterDeclaration.deserialize(self.serializer, **data)
     self.assertEqual(float('-inf'), declaration.min_value)
     self.assertEqual(float('+inf'), declaration.max_value)
     self.assertEqual(data['default_value'], declaration.default_value)
     self.assertEqual(data['name'], declaration.name)
     self.assertIsNone(declaration.identifier)
Пример #3
0
 def test_deserialize_all_default(self) -> None:
     data = dict(min_value=float('-inf'), max_value=float('+inf'), default_value=None, name='foo')
     declaration = ParameterDeclaration.deserialize(self.serializer, **data)
     self.assertEqual(data['min_value'], declaration.min_value)
     self.assertEqual(data['max_value'], declaration.max_value)
     self.assertEqual(data['default_value'], declaration.default_value)
     self.assertEqual(data['name'], declaration.name)
     self.assertIsNone(declaration.identifier)