MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_call_with_kwargs

Method test_call_with_kwargs

test/orm/test_scoping.py:115–136  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

113 )
114
115 def test_call_with_kwargs(self):
116 mock_scope_func = Mock()
117 SessionMaker = sa.orm.sessionmaker()
118 Session = scoped_session(sa.orm.sessionmaker(), mock_scope_func)
119
120 s0 = SessionMaker()
121 assert s0.autoflush == True
122
123 mock_scope_func.return_value = 0
124 s1 = Session()
125 assert s1.autoflush == True
126
127 assert_raises_message(
128 sa.exc.InvalidRequestError,
129 "Scoped session is already present",
130 Session,
131 autoflush=False,
132 )
133
134 mock_scope_func.return_value = 1
135 s2 = Session(autoflush=False)
136 assert s2.autoflush == False
137
138 def test_methods_etc(self):
139 mock_session = Mock()

Callers

nothing calls this directly

Calls 3

scoped_sessionClass · 0.90
SessionClass · 0.90
assert_raises_messageFunction · 0.90

Tested by

no test coverage detected