(self)
| 63 | assert_raises(IndexError, setattr, a2, "fifth", 10) |
| 64 | |
| 65 | def test_json(self): |
| 66 | Base = declarative_base() |
| 67 | |
| 68 | class J(Base): |
| 69 | __tablename__ = "j" |
| 70 | id = Column("id", Integer, primary_key=True) |
| 71 | json = Column("_json", JSON, default={}) |
| 72 | field = index_property("json", "field") |
| 73 | |
| 74 | j = J(json={"a": 1, "b": 2}) |
| 75 | assert_raises(AttributeError, lambda: j.field) |
| 76 | j.field = "test" |
| 77 | eq_(j.field, "test") |
| 78 | eq_(j.json, {"a": 1, "b": 2, "field": "test"}) |
| 79 | |
| 80 | j2 = J(field="test") |
| 81 | eq_(j2.json, {"field": "test"}) |
| 82 | eq_(j2.field, "test") |
| 83 | |
| 84 | def test_value_is_none_attributeerror(self): |
| 85 | Base = declarative_base() |
nothing calls this directly
no test coverage detected