MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_insert

Method test_insert

test/orm/test_unitofwork.py:584–593  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

582 eq_(u.counter, 2)
583
584 def test_insert(self):
585 User = self.classes.User
586
587 u = User(name="test", counter=sa.select(5).scalar_subquery())
588
589 session = fixture_session()
590 session.add(u)
591 session.flush()
592
593 assert (u.counter == 5) is True
594
595 @testing.requires.sql_expressions_inserted_as_primary_key
596 def test_insert_pk_expression(self):

Callers

nothing calls this directly

Calls 6

fixture_sessionFunction · 0.90
UserClass · 0.70
scalar_subqueryMethod · 0.45
selectMethod · 0.45
addMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected