[Zope3-checkins] CVS: Zope3/src/zope/app/schema/tests - test_vocabulary.py:1.1.2.5

Fred L. Drake, Jr. fred@zope.com
Thu, 15 May 2003 11:51:05 -0400


Update of /cvs-repository/Zope3/src/zope/app/schema/tests
In directory cvs.zope.org:/tmp/cvs-serv21908

Modified Files:
      Tag: schema-vocabulary-branch
	test_vocabulary.py 
Log Message:
avoid a bit more repitition


=== Zope3/src/zope/app/schema/tests/test_vocabulary.py 1.1.2.4 => 1.1.2.5 ===
--- Zope3/src/zope/app/schema/tests/test_vocabulary.py:1.1.2.4	Thu May 15 11:05:27 2003
+++ Zope3/src/zope/app/schema/tests/test_vocabulary.py	Thu May 15 11:51:02 2003
@@ -39,7 +39,7 @@
                           vocabulary.vocabularyService.get,
                           None, "missing-vocabulary")
 
-    def check_vocabulary_get(self, **kw):
+    def check_vocabulary_get(self, kw={}):
         context = object()
         vocab = vocabulary.vocabularyService.get(context, "my-vocab")
         self.assert_(vocab.ob is context)
@@ -67,6 +67,9 @@
         finally:
             f.close()
 
+    extra_keywords = {"filter": "my-filter",
+                      "another": "keyword"}
+
     def test_simple_zcml(self):
         self.load_zcml("""\
           <vocabulary
@@ -83,7 +86,7 @@
               filter='my-filter'
               another='keyword'
               />""")
-        self.check_vocabulary_get(filter="my-filter", another="keyword")
+        self.check_vocabulary_get(self.extra_keywords)
 
     def test_action_without_keywords(self):
         # make sure the action machinery works, aside from ZCML concerns
@@ -103,7 +106,7 @@
     def test_action_with_keywords(self):
         # make sure the action machinery works, aside from ZCML concerns
         actions = vocabulary.register(MyContext(), "my-vocab", ".maker",
-                                      filter="my-filter", another="keyword")
+                                      **self.extra_keywords)
         self.assertEqual(len(actions), 1)
         descriminator, callable, args, kw = actions[0]
         # check our expectations of the action:
@@ -114,7 +117,7 @@
         # enact the registration:
         callable(*args, **kw)
         # make sure the factory behaves as expected:
-        self.check_vocabulary_get(filter="my-filter", another="keyword")
+        self.check_vocabulary_get(self.extra_keywords)
 
 
 def test_suite():