summaryrefslogtreecommitdiff
path: root/tests/test_lobject.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_lobject.py')
-rwxr-xr-xtests/test_lobject.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/test_lobject.py b/tests/test_lobject.py
index b5d5d63..7f600e3 100755
--- a/tests/test_lobject.py
+++ b/tests/test_lobject.py
@@ -167,9 +167,34 @@ class LargeObjectTests(LargeObjectMixin, unittest.TestCase):
lo.close()
lo = self.conn.lobject(lo.oid)
- self.assertEqual(lo.read(4), b("some"))
+ x = lo.read(4)
+ self.assertEqual(type(x), type(''))
+ self.assertEqual(x, "some")
+ self.assertEqual(lo.read(), " data")
+
+ def test_read_binary(self):
+ lo = self.conn.lobject()
+ length = lo.write(b("some data"))
+ lo.close()
+
+ lo = self.conn.lobject(lo.oid, "rb")
+ x = lo.read(4)
+ self.assertEqual(type(x), type(b('')))
+ self.assertEqual(x, "some")
self.assertEqual(lo.read(), b(" data"))
+ def test_read_text(self):
+ lo = self.conn.lobject()
+ snowman = u"\u2603"
+ length = lo.write(u"some data " + snowman)
+ lo.close()
+
+ lo = self.conn.lobject(lo.oid, "rt")
+ x = lo.read(4)
+ self.assertEqual(type(x), type(u''))
+ self.assertEqual(x, u"some")
+ self.assertEqual(lo.read(), u" data " + snowman)
+
def test_read_large(self):
lo = self.conn.lobject()
data = b("data") * 1000000