(cls)
| 164 | |
| 165 | @classmethod |
| 166 | def setup_mappers(cls): |
| 167 | global WeatherLocation, Report |
| 168 | |
| 169 | class WeatherLocation: |
| 170 | def __init__(self, continent, city): |
| 171 | self.continent = continent |
| 172 | self.city = city |
| 173 | |
| 174 | class Report: |
| 175 | def __init__(self, temperature, id_=None): |
| 176 | self.temperature = temperature |
| 177 | if id_: |
| 178 | self.id = id_ |
| 179 | |
| 180 | weather_locations = cls.tables.weather_locations |
| 181 | |
| 182 | cls.mapper_registry.map_imperatively( |
| 183 | WeatherLocation, |
| 184 | weather_locations, |
| 185 | properties={ |
| 186 | "reports": relationship(Report, backref="location"), |
| 187 | "city": deferred(weather_locations.c.city), |
| 188 | }, |
| 189 | ) |
| 190 | |
| 191 | weather_reports = cls.tables.weather_reports |
| 192 | |
| 193 | cls.mapper_registry.map_imperatively(Report, weather_reports) |
| 194 | |
| 195 | def _fixture_data(self): |
| 196 | tokyo = WeatherLocation("Asia", "Tokyo") |
nothing calls this directly
no test coverage detected