1 from nose
.tools
import *
3 from sqlalchemy
.orm
import aliased
5 from pokedex
.db
import connect
, tables
7 def test_encounter_slots():
8 # Encounters have a version, which has a version group; encounters also
9 # have an encounter_slot, which has a version group. The two version
10 # groups should match, universally.
13 version_group_a
= aliased(tables
.VersionGroup
)
14 version_group_b
= aliased(tables
.VersionGroup
)
16 sanity_q
= session
.query(tables
.Encounter
) \
17 .join((tables
.EncounterSlot
, tables
.Encounter
.slot
)) \
18 .join((version_group_a
, tables
.EncounterSlot
.version_group
)) \
19 .join((tables
.Version
, tables
.Encounter
.version
)) \
20 .join((version_group_b
, tables
.Version
.version_group
)) \
21 .filter(version_group_a
.id != version_group_b
.id)
23 assert_equal(sanity_q
.count(), 0,
24 "Encounter slots all match the encounters they belong to")