Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_from_json_with_decoder_params():
@dataclass
class DataClass(DataClassJSONMixin):
x: List[float]
def multiple_by_ten(s):
return int(s) * 10
instance = DataClass(x=[10, 20, 30])
dumped = json.dumps({'x': [1, 2, 3]})
assert DataClass.from_json(dumped, parse_int=multiple_by_ten) == instance
assert DataClass.from_json(dumped) != instance