[Zope3-checkins] SVN: Zope3/trunk/src/zope/schema/tests/test_vocabulary.py Test for SimpleTerm.title added

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Mar 18 07:32:52 EST 2005


Log message for revision 29556:
  Test for SimpleTerm.title added
  

Changed:
  U   Zope3/trunk/src/zope/schema/tests/test_vocabulary.py

-=-
Modified: Zope3/trunk/src/zope/schema/tests/test_vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_vocabulary.py	2005-03-18 12:26:55 UTC (rev 29555)
+++ Zope3/trunk/src/zope/schema/tests/test_vocabulary.py	2005-03-18 12:32:52 UTC (rev 29556)
@@ -18,6 +18,7 @@
 import unittest
 
 from zope.interface.verify import verifyObject
+from zope.interface.exceptions import DoesNotImplement
 from zope.interface import Interface, implements
 
 from zope.schema import interfaces
@@ -97,6 +98,17 @@
         self.assertEqual(t.value, 1)
         self.assertEqual(t.token, "One")
 
+    def test_simple_term_title(self):
+        t = vocabulary.SimpleTerm(1)
+        verifyObject(interfaces.ITokenizedTerm, t)
+        self.failUnlessRaises(DoesNotImplement, verifyObject,
+            interfaces.ITitledTokenizedTerm, t)
+        self.failUnless(t.title is None)
+        t = vocabulary.SimpleTerm(1, title="Title")
+        verifyObject(interfaces.ITokenizedTerm, t)
+        verifyObject(interfaces.ITitledTokenizedTerm, t)
+        self.failUnlessEqual(t.title, "Title")
+
     def test_order(self):
         value = 1
         for t in self.list_vocab:



More information about the Zope3-Checkins mailing list