testinggtk r128 - trunk/tests
- From: bjornl svn gnome org
- To: svn-commits-list gnome org
- Subject: testinggtk r128 - trunk/tests
- Date: Sun, 15 Jun 2008 03:07:41 +0000 (UTC)
Author: bjornl
Date: Sun Jun 15 03:07:40 2008
New Revision: 128
URL: http://svn.gnome.org/viewvc/testinggtk?rev=128&view=rev
Log:
Tests for set_column_types and for TypeErrors from append()
Modified:
trunk/tests/test_liststore.py
Modified: trunk/tests/test_liststore.py
==============================================================================
--- trunk/tests/test_liststore.py (original)
+++ trunk/tests/test_liststore.py Sun Jun 15 03:07:40 2008
@@ -2,6 +2,7 @@
Tests for the ``gtk.ListStore`` class.
'''
import gtk
+import utils
def test_iter_in_empty_store():
liststore = gtk.ListStore(str)
@@ -40,6 +41,41 @@
assert False
except TypeError:
assert True
-
+def test_adding_wrong_length_row():
+ '''
+ Ensure that a ``ValueError`` is raised if a row that has wrong
+ length is added to a ``gtk.ListStore``.
+ '''
+ store = gtk.ListStore(int, int)
+ try:
+ store.append(1, 2, 3, 4)
+ assert False
+ except TypeError:
+ assert True
+ try:
+ store.append(1)
+ assert False
+ except TypeError:
+ assert True
+
+ utils pass_on_warnings
+def test_set_column_types_on_non_empty_store():
+ '''
+ Ensure that a warning is printed if ``set_column_types`` is called
+ on a ``gtk.ListStore`` with one row.
+ '''
+ store = gtk.ListStore(str, int, bool)
+ store.append(['hi', 3, False])
+ store.set_column_types(str)
+
+def test_set_colum_types():
+ '''
+ Ensure that increasing the number of columns in ``gtk.ListStore``
+ is possible using ``set_column_types``.
+ '''
+ store = gtk.ListStore(int)
+ for x in range(1, 50):
+ cols = [int] * x
+ store.set_column_types(*cols)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]