Fix test for missing default forms

This commit is contained in:
Andrew Ekstedt 2021-03-09 22:28:31 -08:00
parent a91a7d95b3
commit de27f2c282

View file

@ -110,8 +110,8 @@ def test_default_forms(session):
default pokemon.""" default pokemon."""
q = session.query(tables.Pokemon) q = session.query(tables.Pokemon)
q = q.join(tables.PokemonForm) # TODO: could use table.Pokemon.forms.and_: https://docs.sqlalchemy.org/en/14/orm/queryguide.html#orm-queryguide-join-on-augmented
q = q.filter(tables.PokemonForm.is_default==True) q = q.outerjoin(tables.PokemonForm, (tables.PokemonForm.pokemon_id == tables.Pokemon.id) & (tables.PokemonForm.is_default==True))
q = q.options(lazyload('*')) q = q.options(lazyload('*'))
q = q.group_by(tables.Pokemon) q = q.group_by(tables.Pokemon)
q = q.add_columns(func.count(tables.PokemonForm.id)) q = q.add_columns(func.count(tables.PokemonForm.id))
@ -123,8 +123,7 @@ def test_default_forms(session):
pytest.fail("pokemon %s has %d default forms" % (pokemon.name, num_default_forms)) pytest.fail("pokemon %s has %d default forms" % (pokemon.name, num_default_forms))
q = session.query(tables.PokemonSpecies) q = session.query(tables.PokemonSpecies)
q = q.join(tables.Pokemon) q = q.outerjoin(tables.Pokemon, (tables.Pokemon.species_id == tables.PokemonSpecies.id) & (tables.Pokemon.is_default==True))
q = q.filter(tables.Pokemon.is_default==True)
q = q.options(lazyload('*')) q = q.options(lazyload('*'))
q = q.group_by(tables.PokemonSpecies) q = q.group_by(tables.PokemonSpecies)
q = q.add_columns(func.count(tables.Pokemon.id)) q = q.add_columns(func.count(tables.Pokemon.id))