summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2008-08-11 22:05:06 +0000
committerPaul Pogonyshev <paulp@src.gnome.org>2008-08-11 22:05:06 +0000
commitb33d25d72bb0eeeafeedb0e03755e9eab40ab9ba (patch)
treeb6eb04d4f90e09e0e62da259b99b10bc26151f38 /tests
parent35092e66e988321abd9b55b9f693090b7b15bad3 (diff)
downloadpygobject-b33d25d72bb0eeeafeedb0e03755e9eab40ab9ba.tar.gz
pygobject-b33d25d72bb0eeeafeedb0e03755e9eab40ab9ba.tar.xz
pygobject-b33d25d72bb0eeeafeedb0e03755e9eab40ab9ba.zip
Bug 547354 – wrap a few memory stream methods
2008-08-12 Paul Pogonyshev <pogonyshev@gmx.net> Bug 547354 – wrap a few memory stream methods * gio/ginputstream.override (_wrap_g_memory_input_stream_add_data): New function. * gio/gio.defs (gio.MemoryOutputStream.get_contents): Rename from get_data() to avoid name clash. * gio/goutputstream.override (_wrap_g_memory_output_stream_new) (_wrap_g_memory_output_stream_get_data): New functions. * tests/test_gio.py (TestMemoryInputStream) (TestMemoryOutputStream): New test cases. svn path=/trunk/; revision=944
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 7500e58..2fb5c3a 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -545,6 +545,20 @@ class TestInputStream(unittest.TestCase):
loop.run()
+class TestMemoryInputStream(unittest.TestCase):
+ def setUp(self):
+ self.stream = gio.MemoryInputStream()
+
+ def test_add_data(self):
+ self.stream.add_data('foobar')
+ self.assertEquals('foobar', self.stream.read())
+
+ self.stream.add_data('ham ')
+ self.stream.add_data(None)
+ self.stream.add_data('spam')
+ self.assertEquals('ham spam', self.stream.read())
+
+
class TestOutputStream(unittest.TestCase):
def setUp(self):
self._f = open("outputstream.txt", "w")
@@ -614,6 +628,18 @@ class TestOutputStream(unittest.TestCase):
loop.run()
+class TestMemoryOutputStream(unittest.TestCase):
+ def setUp(self):
+ self.stream = gio.MemoryOutputStream()
+
+ def test_get_contents(self):
+ self.stream.write('foobar')
+ self.assertEquals('foobar', self.stream.get_contents())
+
+ self.stream.write('baz')
+ self.assertEquals('foobarbaz', self.stream.get_contents())
+
+
class TestVolumeMonitor(unittest.TestCase):
def setUp(self):
self.monitor = gio.volume_monitor_get()