MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_get_one

Method test_get_one

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

Source from the content-addressed store, hash-verified

229 is_(t2, tokyo)
230
231 def test_get_one(self):
232 sess = self._fixture_data()
233 brasilia = sess.get_one(WeatherLocation, 6)
234 eq_(brasilia.id, 6)
235 eq_(brasilia.city, "Brasilia")
236
237 toronto = sess.get_one(WeatherLocation, 3)
238 eq_(toronto.id, 3)
239 eq_(toronto.city, "Toronto")
240
241 with expect_raises_message(
242 exc.NoResultFound, "No row was found when one was required"
243 ):
244 sess.get_one(WeatherLocation, 25)
245
246 def test_get_explicit_shard(self):
247 sess = self._fixture_data()

Callers

nothing calls this directly

Calls 4

_fixture_dataMethod · 0.95
eq_Function · 0.90
expect_raises_messageFunction · 0.90
get_oneMethod · 0.45

Tested by

no test coverage detected