I propose making each class responsible for the parsing of itself, in its own little world.
One example for the Tournament class:
class Tournament:
# Current class definition
@classmethod
def from_dict(cls, d: dict):
# here d is extracted from Event.reader
# basically (selectively) copy-paste the code of __build_tournament()
# One caveat is that we need to somehow get the warnings and errors in the correct place
return cls(...)
This would allow us to test those parts in isolation more easily, e.g. by slicing parts of the file and seeing if it still parses how we want it to
I propose making each class responsible for the parsing of itself, in its own little world.
One example for the
Tournament
class:This would allow us to test those parts in isolation more easily, e.g. by slicing parts of the file and seeing if it still parses how we want it to