MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_array_longinit

Method test_array_longinit

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

Source from the content-addressed store, hash-verified

44 eq_(a2.array, [5])
45
46 def test_array_longinit(self):
47 Base = declarative_base()
48
49 class A(Base):
50 __tablename__ = "a"
51 id = Column("id", Integer, primary_key=True)
52 array = Column("_array", ARRAY(Integer), default=[])
53 first = index_property("array", 0)
54
55 fifth = index_property("array", 4)
56
57 a1 = A(fifth=10)
58 a2 = A(first=5)
59
60 eq_(a1.array, [None, None, None, None, 10])
61 eq_(a2.array, [5])
62
63 assert_raises(IndexError, setattr, a2, "fifth", 10)
64
65 def test_json(self):
66 Base = declarative_base()

Callers

nothing calls this directly

Calls 4

declarative_baseFunction · 0.90
eq_Function · 0.90
assert_raisesFunction · 0.90
AClass · 0.70

Tested by

no test coverage detected