mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-23 01:16:34 +03:00
Added test to verify copy_from() with columns.
This commit is contained in:
parent
927f2bb1f1
commit
cb8128c6d4
|
@ -54,10 +54,23 @@ class CopyTests(unittest.TestCase):
|
|||
# Trying to trigger a "would block" error
|
||||
curs = self.conn.cursor()
|
||||
try:
|
||||
self._copy_from(curs, nrecs=10*1024, srec=10*1024, copykw={'size': 20*1024*1024})
|
||||
self._copy_from(curs, nrecs=10*1024, srec=10*1024,
|
||||
copykw={'size': 20*1024*1024})
|
||||
finally:
|
||||
curs.close()
|
||||
|
||||
def test_copy_from_cols(self):
|
||||
curs = self.conn.cursor()
|
||||
f = StringIO()
|
||||
for i in xrange(10):
|
||||
f.write("%s\n" % (i,))
|
||||
|
||||
f.seek(0)
|
||||
curs.copy_from(MinimalRead(f), "tcopy", columns=['id'])
|
||||
|
||||
curs.execute("select * from tcopy order by id")
|
||||
self.assertEqual([(i, None) for i in range(10)], curs.fetchall())
|
||||
|
||||
def test_copy_to(self):
|
||||
curs = self.conn.cursor()
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user