MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _fixture_data

Method _fixture_data

test/ext/test_horizontal_shard.py:195–218  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

193 cls.mapper_registry.map_imperatively(Report, weather_reports)
194
195 def _fixture_data(self):
196 tokyo = WeatherLocation("Asia", "Tokyo")
197 newyork = WeatherLocation("North America", "New York")
198 toronto = WeatherLocation("North America", "Toronto")
199 london = WeatherLocation("Europe", "London")
200 dublin = WeatherLocation("Europe", "Dublin")
201 brasilia = WeatherLocation("South America", "Brasilia")
202 quito = WeatherLocation("South America", "Quito")
203 tokyo.reports.append(Report(80.0, id_=1))
204 newyork.reports.append(Report(75, id_=1))
205 quito.reports.append(Report(85))
206 sess = sharded_session()
207 for c in [tokyo, newyork, toronto, london, dublin, brasilia, quito]:
208 sess.add(c)
209 sess.flush()
210
211 eq_(inspect(newyork).key[2], "north_america")
212 eq_(inspect(newyork).identity_token, "north_america")
213 eq_(inspect(dublin).key[2], "europe")
214 eq_(inspect(dublin).identity_token, "europe")
215
216 sess.commit()
217 sess.close()
218 return sess
219
220 def test_get(self):
221 sess = self._fixture_data()

Calls 9

eq_Function · 0.90
inspectFunction · 0.90
WeatherLocationClass · 0.70
ReportClass · 0.70
appendMethod · 0.45
addMethod · 0.45
flushMethod · 0.45
commitMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected