MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_immutable

Method test_set_immutable

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

Source from the content-addressed store, hash-verified

108 assert_raises(AttributeError, lambda: a.first)
109
110 def test_set_immutable(self):
111 Base = declarative_base()
112
113 class A(Base):
114 __tablename__ = "a"
115 id = Column(Integer, primary_key=True)
116 array = Column(ARRAY(Integer))
117 first = index_property("array", 1, mutable=False)
118
119 a = A()
120
121 def set_():
122 a.first = 10
123
124 assert_raises(AttributeError, set_)
125
126 def test_set_mutable_dict(self):
127 Base = declarative_base()

Callers

nothing calls this directly

Calls 3

declarative_baseFunction · 0.90
assert_raisesFunction · 0.90
AClass · 0.70

Tested by

no test coverage detected