MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_mutable_dict

Method test_set_mutable_dict

test/ext/test_indexable.py:126–144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

124 assert_raises(AttributeError, set_)
125
126 def test_set_mutable_dict(self):
127 Base = declarative_base()
128
129 class J(Base):
130 __tablename__ = "j"
131 id = Column(Integer, primary_key=True)
132 json = Column(JSON, default={})
133 field = index_property("json", "field")
134
135 j = J()
136
137 j.field = 10
138
139 j.json = {}
140 assert_raises(AttributeError, lambda: j.field)
141 assert_raises(AttributeError, delattr, j, "field")
142
143 j.field = 10
144 eq_(j.field, 10)
145
146 def test_get_default_value(self):
147 Base = declarative_base()

Callers

nothing calls this directly

Calls 4

declarative_baseFunction · 0.90
assert_raisesFunction · 0.90
eq_Function · 0.90
JClass · 0.85

Tested by

no test coverage detected