MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_update_counter

Method test_update_counter

test/orm/test_cycles.py:1620–1628  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

1618 counter = mapped_column(Integer, onupdate=_counter)
1619
1620 def test_update_counter(self, connection):
1621 Parent, Related = self.classes("Parent", "Related")
1622
1623 p1 = Parent(related=[Related(), Related(), Related()])
1624 with Session(connection, expire_on_commit=False) as sess:
1625 sess.add(p1)
1626 sess.commit()
1627
1628 eq_([rel.counter for rel in p1.related], [1, 2, 3])
1629
1630
1631class PostUpdateBatchingTest(fixtures.MappedTest):

Callers

nothing calls this directly

Calls 6

SessionClass · 0.90
eq_Function · 0.90
ParentClass · 0.70
RelatedClass · 0.70
addMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected