Skip to content

Commit bc9c685

Browse files
committed
added test for Alter.set_null
1 parent 9fc58bd commit bc9c685

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/table/test_alter.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,23 @@ def test_multiple(self):
138138
self.assertTrue("column_b" in column_names)
139139

140140

141+
@postgres_only
141142
class TestNull(DBTestCase):
142143
def test_null(self):
143-
pass
144+
query = """
145+
SELECT is_nullable FROM information_schema.columns
146+
WHERE table_name = 'band'
147+
AND table_catalog = 'piccolo'
148+
AND column_name = 'popularity'
149+
"""
150+
151+
Band.alter().set_null(Band.popularity, boolean=True).run_sync()
152+
response = Band.raw(query).run_sync()
153+
self.assertTrue(response[0]["is_nullable"] == "YES")
154+
155+
Band.alter().set_null(Band.popularity, boolean=False).run_sync()
156+
response = Band.raw(query).run_sync()
157+
self.assertTrue(response[0]["is_nullable"] == "NO")
144158

145159

146160
@postgres_only

0 commit comments

Comments
 (0)