MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_setdefault

Method test_setdefault

test/ext/test_mutable.py:419–438  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

417 eq_(f1.data, orig)
418
419 def test_setdefault(self):
420 sess = fixture_session()
421
422 f1 = Foo(data={"a": "b"})
423 sess.add(f1)
424 sess.commit()
425
426 eq_(f1.data.setdefault("c", "d"), "d")
427 sess.commit()
428
429 eq_(f1.data, {"a": "b", "c": "d"})
430
431 eq_(f1.data.setdefault("c", "q"), "d")
432 sess.commit()
433
434 eq_(f1.data, {"a": "b", "c": "d"})
435
436 eq_(f1.data.setdefault("w", None), None)
437 sess.commit()
438 eq_(f1.data, {"a": "b", "c": "d", "w": None})
439
440 def test_replace(self):
441 sess = fixture_session()

Callers

nothing calls this directly

Calls 6

fixture_sessionFunction · 0.90
eq_Function · 0.90
FooClass · 0.70
addMethod · 0.45
commitMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected