MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_insert_via_seq

Method test_insert_via_seq

test/sql/test_sequences.py:616–635  ·  view source on GitHub ↗
(
        self, table_fixture, connection, implicit_returning
    )

Source from the content-addressed store, hash-verified

614 argnames="implicit_returning",
615 )
616 def test_insert_via_seq(
617 self, table_fixture, connection, implicit_returning
618 ):
619 Manager, cartitems = table_fixture(implicit_returning)
620
621 connection.execute(cartitems.insert(), dict(description="hi"))
622 connection.execute(cartitems.insert(), dict(description="there"))
623 r = connection.execute(cartitems.insert(), dict(description="lala"))
624
625 expected = 2 + testing.db.dialect.default_sequence_base
626 eq_(r.inserted_primary_key[0], expected)
627
628 eq_(
629 connection.scalar(
630 sa.select(cartitems.c.cart_id).where(
631 cartitems.c.description == "lala"
632 ),
633 ),
634 expected,
635 )
636
637 @testing.combinations(
638 (True, testing.requires.insert_returning),

Callers

nothing calls this directly

Calls 6

eq_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
scalarMethod · 0.45
whereMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected