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

Method test_setdefault

test/ext/test_mutable.py:419–438  ·  test/ext/test_mutable.py::_MutableDictTestBase.test_setdefault
(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={class="st">"a": class="st">"b"})
423 sess.add(f1)
424 sess.commit()
425
426 eq_(f1.data.setdefault(class="st">"c", class="st">"d"), class="st">"d")
427 sess.commit()
428
429 eq_(f1.data, {class="st">"a": class="st">"b", class="st">"c": class="st">"d"})
430
431 eq_(f1.data.setdefault(class="st">"c", class="st">"q"), class="st">"d")
432 sess.commit()
433
434 eq_(f1.data, {class="st">"a": class="st">"b", class="st">"c": class="st">"d"})
435
436 eq_(f1.data.setdefault(class="st">"w", None), None)
437 sess.commit()
438 eq_(f1.data, {class="st">"a": class="st">"b", class="st">"c": class="st">"d", class="st">"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