def test_dumps_nested_new_type(self): raw_value = 'd1d61dd7-c036-47d3-a6ed-91cc2e885fc8' id_value = ProductId(Id(UUID(raw_value))) d_new_type = DataClassWithNestedNewType(id_value) assert DataClassWithNestedNewType.schema().dumps(d_new_type) == f'{{"id": "{raw_value}"}}'
def test_nested_new_type_decode(self): assert (DataClassWithNestedNewType.from_json( self.dc_new_type_json) == DataClassWithNestedNewType( ProductId(Id(UUID(self.new_type_s)))))
def test_nested_new_type_encode(self): assert (DataClassWithNestedNewType(ProductId(Id(UUID( self.new_type_s)))).to_json() == self.dc_new_type_json)