Skip to content

Commit 15f49b0

Browse files
committed
added test for Alter.set_length
1 parent bc9c685 commit 15f49b0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/table/test_alter.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def test_multiple(self):
139139

140140

141141
@postgres_only
142-
class TestNull(DBTestCase):
143-
def test_null(self):
142+
class TestSetNull(DBTestCase):
143+
def test_set_null(self):
144144
query = """
145145
SELECT is_nullable FROM information_schema.columns
146146
WHERE table_name = 'band'
@@ -157,6 +157,22 @@ def test_null(self):
157157
self.assertTrue(response[0]["is_nullable"] == "NO")
158158

159159

160+
@postgres_only
161+
class TestSetLength(DBTestCase):
162+
def test_set_length(self):
163+
query = """
164+
SELECT character_maximum_length FROM information_schema.columns
165+
WHERE table_name = 'band'
166+
AND table_catalog = 'piccolo'
167+
AND column_name = 'name'
168+
"""
169+
170+
for length in (5, 20, 50):
171+
Band.alter().set_length(Band.name, length=length).run_sync()
172+
response = Band.raw(query).run_sync()
173+
self.assertTrue(response[0]["character_maximum_length"] == length)
174+
175+
160176
@postgres_only
161177
class TestSetDefault(DBTestCase):
162178
def test_set_default(self):

0 commit comments

Comments
 (0)