Accept overflow errors testing for LO64 funcs

It is raised on 32 bits by PyArg_ParseTuple. We may work around on
truncate (maybe parsing a py_ssize_t) but we would have the same problem
on seek as the offset is signed.
This commit is contained in:
Daniele Varrazzo 2015-02-08 02:04:41 +00:00
parent 7ce7fef322
commit e490e3bfa3

View File

@ -488,14 +488,14 @@ class LargeObjectNot64Tests(LargeObjectTestCase):
lo = self.conn.lobject() lo = self.conn.lobject()
offset = 1 << 32 # 4gb offset = 1 << 32 # 4gb
self.assertRaises( self.assertRaises(
(psycopg2.InterfaceError, psycopg2.NotSupportedError), (OverflowError, psycopg2.InterfaceError, psycopg2.NotSupportedError),
lo.seek, offset, 0) lo.seek, offset, 0)
def test_truncate_larger_than_2gb(self): def test_truncate_larger_than_2gb(self):
lo = self.conn.lobject() lo = self.conn.lobject()
length = 1 << 32 # 4gb length = 1 << 32 # 4gb
self.assertRaises( self.assertRaises(
(psycopg2.InterfaceError, psycopg2.NotSupportedError), (OverflowError, psycopg2.InterfaceError, psycopg2.NotSupportedError),
lo.truncate, length) lo.truncate, length)
decorate_all_tests(LargeObjectNot64Tests, decorate_all_tests(LargeObjectNot64Tests,