def __init__(self, data, parent): super().__init__(data, parent) self.teams = {team['id']: Team(team) for team in data.get('teams', {})} self.subleagues = { sl['id']: Subleague(sl) for sl in data.get('subleagues', {}) } self.divisions = { d['id']: Division(d) for d in data.get('divisions', {}) } self.leagues = {l['id']: League(l) for l in data.get('leagues', {})}
def subleague_good(self): return Subleague.load("7d3a3dd6-9ea1-4535-9d91-bde875c85e80")
def subleague_wild(self): return Subleague.load("aabc11a1-81af-4036-9f18-229c759ca8a9")
def subleague_mild(self): return Subleague.load("4fe65afa-804f-4bb2-9b15-1281b2eab110")
def test_load_bad_id(self): with pytest.raises(ValueError): bad_id = Subleague.load("00000000-0000-0000-0000-000000000000")
def test_load(self): subleague = Subleague.load("7d3a3dd6-9ea1-4535-9d91-bde875c85e80") assert isinstance(subleague, Subleague)