MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_bulk_update

Method test_bulk_update

test/orm/test_versioning.py:287–309  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

285 )
286
287 def test_bulk_update(self):
288 Foo = self.classes.Foo
289
290 s1 = self._fixture()
291 f1 = Foo(value="f1")
292 f2 = Foo(value="f2")
293 s1.add_all((f1, f2))
294 s1.commit()
295
296 with conditional_sane_rowcount_warnings(update=True):
297 s1.bulk_update_mappings(
298 Foo,
299 [
300 {"id": f1.id, "value": "f1rev2", "version_id": 1},
301 {"id": f2.id, "value": "f2rev2", "version_id": 1},
302 ],
303 )
304 s1.commit()
305
306 eq_(
307 s1.query(Foo.id, Foo.value, Foo.version_id).order_by(Foo.id).all(),
308 [(f1.id, "f1rev2", 2), (f2.id, "f2rev2", 2)],
309 )
310
311 def test_bump_version(self):
312 """test that version number can be bumped.

Callers

nothing calls this directly

Calls 10

_fixtureMethod · 0.95
eq_Function · 0.90
FooClass · 0.70
add_allMethod · 0.45
commitMethod · 0.45
bulk_update_mappingsMethod · 0.45
allMethod · 0.45
order_byMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected