summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2008-08-12 20:00:48 +0000
committerPaul Pogonyshev <paulp@src.gnome.org>2008-08-12 20:00:48 +0000
commit9ecb2ef1203b8667f4c05798f5bf9306f599bbab (patch)
tree0d5b2df37621c7e650ecd32b9da7e7af1133dfa2 /tests
parentad7a6f15aafaf6d962ebbd2a8431fd17e6abfc30 (diff)
downloadpygobject-9ecb2ef1203b8667f4c05798f5bf9306f599bbab.tar.gz
pygobject-9ecb2ef1203b8667f4c05798f5bf9306f599bbab.tar.xz
pygobject-9ecb2ef1203b8667f4c05798f5bf9306f599bbab.zip
Bug 547484 – wrap gio.DataInputStream.read_line and ...read_until
2008-08-12 Paul Pogonyshev <pogonyshev@gmx.net> Bug 547484 – wrap gio.DataInputStream.read_line and ...read_until * tests/test_gio.py (TestDataInputStream): New test case. * gio/ginputstream.override (_wrap_g_data_input_stream_read_line) (_wrap_g_data_input_stream_read_until): New functions. svn path=/trunk/; revision=946
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 2fb5c3a..03d09be 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -545,6 +545,27 @@ class TestInputStream(unittest.TestCase):
loop.run()
+class TestDataInputStream(unittest.TestCase):
+ def setUp(self):
+ self.base_stream = gio.MemoryInputStream()
+ self.data_stream = gio.DataInputStream(self.base_stream)
+
+ def test_read_line(self):
+ # Currently fails because GIO itself is buggy. See bug 547481.
+ return
+ self.base_stream.add_data('foo\nbar\n\nbaz')
+ self.assertEquals('foo\n', self.data_stream.read_line())
+ self.assertEquals('bar\n', self.data_stream.read_line())
+ self.assertEquals('\n', self.data_stream.read_line())
+ self.assertEquals('baz', self.data_stream.read_line())
+
+ def test_read_until(self):
+ self.base_stream.add_data('sentence.end of line\nthe rest')
+ self.assertEquals('sentence', self.data_stream.read_until('.!?'))
+ self.assertEquals('end of line', self.data_stream.read_until('\n\r'))
+ self.assertEquals('the rest', self.data_stream.read_until('#$%^&'))
+
+
class TestMemoryInputStream(unittest.TestCase):
def setUp(self):
self.stream = gio.MemoryInputStream()