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

Method test_get_one

test/orm/test_session.py:687–702  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

685 with_for_update_arg.fail()
686
687 def test_get_one(self):
688 users, User = self.tables.users, self.classes.User
689 self.mapper_registry.map_imperatively(User, users)
690
691 s = fixture_session()
692 s.execute(
693 insert(self.tables.users),
694 [{"id": 7, "name": "7"}, {"id": 19, "name": "19"}],
695 )
696 u = s.get_one(User, 7)
697 u2 = s.get_one(User, 7)
698 assertions.is_not_none(u)
699 is_(u, u2)
700 s.expunge_all()
701 u2 = s.get_one(User, 7)
702 is_not(u, u2)
703
704 def test_get_one_2(self):
705 users, User = self.tables.users, self.classes.User

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
insertFunction · 0.90
is_Function · 0.90
is_notFunction · 0.90
map_imperativelyMethod · 0.80
executeMethod · 0.45
get_oneMethod · 0.45
expunge_allMethod · 0.45

Tested by

no test coverage detected