testinggtk r378 - trunk/tests/gdk



Author: bjornl
Date: Wed Aug 20 19:38:52 2008
New Revision: 378
URL: http://svn.gnome.org/viewvc/testinggtk?rev=378&view=rev

Log:
Two tests for wrong options arg type to save() and save_to_callback()

Modified:
   trunk/tests/gdk/test_pixbuf.py

Modified: trunk/tests/gdk/test_pixbuf.py
==============================================================================
--- trunk/tests/gdk/test_pixbuf.py	(original)
+++ trunk/tests/gdk/test_pixbuf.py	Wed Aug 20 19:38:52 2008
@@ -34,3 +34,27 @@
     '''
     pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 100, 100)
     pixbuf.save('foo', 'png', options = None)
+
+def test_save_options_wrong():
+    '''
+    Ensure that a ``TypeError`` is raised if the ``options`` argument
+    to ``save`` is not ``None`` or a mapping.
+    '''
+    pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 100, 100)
+    try:
+        pixbuf.save('foo', 'png', options = 1234)
+        assert False
+    except TypeError:
+        assert True
+
+def test_save_to_callback_options_wrong():
+    '''
+    Ensure that a ``TypeError`` is raised if the ``options`` argument
+    to ``save_to_callback`` is not ``None`` or a mapping.
+    '''
+    pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 100, 100)
+    try:
+        pixbuf.save_to_callback(lambda x: x, 'png', options = 1234)
+        assert False
+    except TypeError:
+        assert True



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]