Skip to content

Commit

Permalink
Add test that inserttable does not miss failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Aug 27, 2023
1 parent c2a4290 commit 8699ace
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_classic_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,20 @@ def testInsertTableBigRowSize(self):
data = [(t,)]
self.assertRaises(MemoryError, self.c.inserttable, 'test', data, ['t'])

def testInsertTableSmallIntOverflow(self):
rest_row = self.data[2][1:]
data = [(32000,) + rest_row]
self.c.inserttable('test', data)
self.assertEqual(self.get_back(), data)
data = [(33000,) + rest_row]
try:
self.c.inserttable('test', data)
except ValueError as e:
self.assertIn(
'value "33000" is out of range for type smallint', str(e))
else:
self.assertFalse('expected an error')


class TestDirectSocketAccess(unittest.TestCase):
"""Test copy command with direct socket access."""
Expand Down

0 comments on commit 8699ace

Please sign in to comment.