def test_default_encoder_is_partial(self): class MockField(interfaces.JSONDeSerializable): def to_partial_json(self): return 'foo' # pragma: no cover @classmethod def from_json(cls, jobj): pass # pragma: no cover mock_field = MockField() from josepy.json_util import Field self.assertIs(Field.default_encoder(mock_field), mock_field) # in particular... self.assertNotEqual('foo', Field.default_encoder(mock_field))
def test_default_encoder_passthrough(self): mock_value = mock.MagicMock() from josepy.json_util import Field self.assertIs(Field.default_encoder(mock_value), mock_value)