def test_infer_missing(self): actual = DataClassWithOptional.from_json('{}', infer_missing=True) assert (actual == DataClassWithOptional(None))
def test_optional(self): assert (DataClassWithOptional.from_json('{"x": 1}') == DataClassWithOptional(1)) assert (DataClassWithOptional.from_json('{"x": null}') == DataClassWithOptional(None))