Whole file

ramonhagenaars/jsons

The author described this change as Solved bug reported in Issue#64.. It counts as a record because the check below fails on the code as it stood at 1452a681b and passes on 27b1968e0, with nothing else changed between the two runs.

Fix saved2019-07-13
Sharing licenceMIT · LICENSE
Change size+3 2

What the code was meant to do, written into the code itself as a save note

Solved bug reported in Issue#64.

The change

6666 return type_
6767
6868 @classmethod
69- def with_load(cls, fork: Optional[bool] = False, **kwargs) -> type:
69+ def with_load(cls, fork: Optional[bool] = False, **kwargs) \
70+ -> Type['JsonSerializable']:
7071 """
7172 Return a class (``type``) that is based on JsonSerializable with the
7273 ``load`` method being automatically provided the given ``kwargs``.
9091 """
9192 @classmethod
9293 def _wrapper(cls_, inst, **kwargs_):
93- return load(inst, cls_, **{**kwargs_, **kwargs})
94+ return load(inst, cls_, fork_inst=cls_, **{**kwargs_, **kwargs})
9495 type_ = cls.fork() if fork else cls
9596 type_.load = _wrapper
9697 return type_

The check that tells the two apart

failpass·tests/test_jsonserializable.py::TestJsonSerializable::test_with_load

Check file tests/test_jsonserializable.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it1452a681b97f3cdecc5a79fd35b6ee7b58269c2e
Broken version dated2019-07-13
Modulejsons.classes.json_serializable
Units changedJsonSerializable
Fingerprintd82802ea718d8e4b
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in ramonhagenaars/jsons