MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_immutable

Method test_immutable

test/base/test_utils.py:508–521  ·  view source on GitHub ↗
(self, d)

Source from the content-addressed store, hash-verified

506class ImmutableTest(fixtures.TestBase):
507 @combinations(util.immutabledict({1: 2, 3: 4}), util.FacadeDict({2: 3}))
508 def test_immutable(self, d):
509 calls = (
510 lambda: d.__delitem__(1),
511 lambda: d.__setitem__(2, 3),
512 lambda: d.__setattr__(2, 3),
513 d.clear,
514 lambda: d.setdefault(1, 3),
515 lambda: d.update({2: 4}),
516 )
517 if hasattr(d, "pop"):
518 calls += (lambda: d.pop(2), d.popitem)
519 for m in calls:
520 with expect_raises_message(TypeError, "object is immutable"):
521 m()
522
523 def test_readonly_properties(self):
524 d = util.ReadOnlyProperties({3: 4})

Callers

nothing calls this directly

Calls 7

expect_raises_messageFunction · 0.90
__delitem__Method · 0.45
__setitem__Method · 0.45
__setattr__Method · 0.45
setdefaultMethod · 0.45
updateMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected