Skip to content

Commit 0cede2a

Browse files
author
James William Pye
committed
That's DML, not DDL. Add a simple DML test validate the result of __call__.
what smoke was i crackin on.
1 parent 97ce7b8 commit 0cede2a

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

postgresql/test/test_driver.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,24 @@ def testChunkDetectInXact(self):
777777
with self.db.xact():
778778
self.testChunking()
779779

780-
def testDDL(self):
780+
def testSimpleDML(self):
781+
self.db.execute("CREATE TEMP TABLE emp(emp_name text, emp_age int)")
782+
try:
783+
mkemp = self.db.prepare("INSERT INTO emp VALUES ($1, $2)")
784+
del_all_emp = self.db.prepare("DELETE FROM emp")
785+
command, count = mkemp('john', 35)
786+
self.failUnlessEqual(command, 'INSERT')
787+
self.failUnlessEqual(count, 1)
788+
command, count = mkemp('jane', 31)
789+
self.failUnlessEqual(command, 'INSERT')
790+
self.failUnlessEqual(count, 1)
791+
command, count = del_all_emp()
792+
self.failUnlessEqual(command, 'DELETE')
793+
self.failUnlessEqual(count, 2)
794+
finally:
795+
self.db.execute("DROP TABLE emp")
796+
797+
def testDML(self):
781798
self.db.execute("CREATE TEMP TABLE t(i int)")
782799
try:
783800
insert_t = self.db.prepare("INSERT INTO t VALUES ($1)")
@@ -803,11 +820,11 @@ def testDDL(self):
803820
finally:
804821
self.db.execute("DROP TABLE t")
805822

806-
def testDDLInXact(self):
823+
def testDMLInXact(self):
807824
with self.db.xact():
808-
self.testDDL()
825+
self.testDML()
809826

810-
def testBatchDDL(self):
827+
def testBatchDML(self):
811828
self.db.execute("CREATE TEMP TABLE t(i int)")
812829
try:
813830
insert_t = self.db.prepare("INSERT INTO t VALUES ($1)")
@@ -826,7 +843,7 @@ def testBatchDDL(self):
826843
finally:
827844
self.db.execute("DROP TABLE t")
828845

829-
def testBatchDDLInXact(self):
846+
def testBatchDMLInXact(self):
830847
with self.db.xact():
831848
self.testBatchDDL()
832849

0 commit comments

Comments
 (0)