MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_nullable_kwarg

Method test_nullable_kwarg

test/sql/test_identity_column.py:124–153  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

122 )
123
124 def test_nullable_kwarg(self):
125 t = Table(
126 "t",
127 MetaData(),
128 Column("a", Integer(), Identity(), nullable=False),
129 Column("b", Integer(), Identity(), nullable=True),
130 Column("c", Integer(), Identity()),
131 )
132
133 is_(t.c.a.nullable, False)
134 is_(t.c.b.nullable, True)
135 is_(t.c.c.nullable, False)
136
137 nullable = ""
138 if getattr(
139 self, "__dialect__", None
140 ) != "default_enhanced" and testing.against("postgresql"):
141 nullable = " NULL"
142
143 self.assert_compile(
144 CreateTable(t),
145 (
146 "CREATE TABLE t ("
147 "a INTEGER GENERATED BY DEFAULT AS IDENTITY, "
148 "b INTEGER GENERATED BY DEFAULT AS IDENTITY%s, "
149 "c INTEGER GENERATED BY DEFAULT AS IDENTITY"
150 ")"
151 )
152 % nullable,
153 )
154
155
156class IdentityDDL(_IdentityDDLFixture, fixtures.TestBase):

Callers

nothing calls this directly

Calls 9

TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90
IntegerClass · 0.90
IdentityClass · 0.90
is_Function · 0.90
CreateTableClass · 0.85
assert_compileMethod · 0.80
againstMethod · 0.45

Tested by

no test coverage detected