[POS-commit] CVS: Kiwi/tests test_CListDelegate.py,1.25,1.26
Christian Reis
kiko at async.com.br
Sun Feb 2 13:44:27 BRDT 2003
Update of /cvs/Kiwi/tests
In directory anthem:/tmp/cvs-serv27751/tests
Modified Files:
test_CListDelegate.py
Log Message:
Implement a type framework for CListDelegate's Column specification.
This will allow us to determine the type manually (avoiding the
autodetection we do today; the autodetection is nice, but it misfires
when we have the wrong sort of data in a column). This was specifically
implemented to support the addition of None as a possible value for
columns (renders as an empty cell), and perhaps DateTime support.
Index: test_CListDelegate.py
===================================================================
RCS file: /cvs/Kiwi/tests/test_CListDelegate.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- test_CListDelegate.py 30 Jan 2003 20:50:00 -0000 1.25
+++ test_CListDelegate.py 2 Feb 2003 14:44:25 -0000 1.26
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import sys
sys.path.insert(0,"..")
+from types import StringType
from Kiwi.Delegates import CListDelegate, Column
from Kiwi.FrameWork import Model
@@ -51,11 +52,13 @@
# Build list of instances
pl = []
p = Person("Christian Robottom Reis", "SHIS QL 20 Conj. 4 Casa 18 Lago Sul",
- 23, "M", 443242.33, 1, TRUE)
+ 23, None, 443242.33, 1, TRUE)
pl.append(p)
p = Person("Johan Dahlin", "R. Thomaz Antonio Gonzaga 75 Ap. 22",
2, "M", 223.33, 2, FALSE)
pl.append(p)
+p = Person("Pedro Bó", None, 21, "X", 666.66, 1, None)
+pl.append(p)
p = Person("Manuela Tiça", "R. dos Carvalhos, 532, Santa Rita do Passa Quatro",
84, "M", 11.33, 3, TRUE)
pl.append(p)
@@ -104,6 +107,15 @@
print "Type check ok"
# Test different constructor forms
+try:
+ cp_fake = CListDelegate(columns_simple, pl[:-1])
+except TypeError:
+ print "Nonetype check ok"
+
+# Specify column type explicitly since it may contain None
+columns_simple[3].type = StringType
+columns[3].type = StringType
+
cp_fake = CListDelegate(columns_simple, pl[:-1])
cp = CListDelegate(columns, pl[:-1])
cp = CListDelegate(columns, handler=select_row)
More information about the POS-commit
mailing list