コード例 #1
0
 def test_deprecation(self):
     with pytest.warns(DeprecationWarning, match='deprecated'):
         Meta()
コード例 #2
0
 def test_deserialize_incorrect_type(self):
     field = Meta()
     value = 1
     with pytest.raises(ValidationError) as excinfo:
         field.deserialize(value)
     assert excinfo.value.args[0] == 'Not a valid mapping type.'
コード例 #3
0
 def test_serialize_incorrect_type(self):
     field = Meta()
     with pytest.raises(ValidationError) as excinfo:
         field.serialize('meta', {'meta': 1})
     assert excinfo.value.args[0] == 'Not a valid mapping type.'
コード例 #4
0
 def test_deserialize(self):
     field = Meta()
     value = {'page': {'offset': 1}}
     result = field.deserialize(value)
     assert result == value
コード例 #5
0
 def test_serialize(self):
     field = Meta()
     result = field.serialize('meta', {'meta': {'page': {'offset': 1}}})
     assert result == {'page': {'offset': 1}}