[Zope3-checkins] CVS: Zope3/src/zope/schema/tests - tabcomplete.py:1.4 test_tabcomplete.py:1.4

Fred L. Drake, Jr. fred@zope.com
Wed, 18 Jun 2003 15:02:47 -0400


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

Modified Files:
	tabcomplete.py test_tabcomplete.py 
Log Message:
Remove ISubsetVocabulary; this is not generally useful given the current
approach to separating the query mechanism from the rest of the vocabulary
interfaces.


=== Zope3/src/zope/schema/tests/tabcomplete.py 1.3 => 1.4 ===
--- Zope3/src/zope/schema/tests/tabcomplete.py:1.3	Wed Jun  4 05:09:46 2003
+++ Zope3/src/zope/schema/tests/tabcomplete.py	Wed Jun 18 15:02:46 2003
@@ -15,7 +15,7 @@
 """Example vocabulary for tab completion."""
 
 
-from zope.schema.interfaces import ITerm, ISubsetVocabulary, IVocabulary
+from zope.schema.interfaces import ITerm, IVocabulary
 from zope.interface import implements
 
 
@@ -60,29 +60,8 @@
         return len(self._values)
 
     def queryForPrefix(self, prefix):
-        return SubsetCompletionVocabulary(self._match_prefix(prefix),
-                                          self)
-
-    def _match_prefix(self, prefix):
         L = [v for v in self._values if v.startswith(prefix)]
         if L:
-            return L
+            return CompletionVocabulary(L)
         else:
             raise LookupError("no entries matching prefix %r" % prefix)
-
-
-class SubsetCompletionVocabulary(CompletionVocabulary):
-    implements(ISubsetVocabulary)
-
-    def __init__(self, values, master):
-        super(SubsetCompletionVocabulary, self).__init__(values)
-        self._master = master
-
-    def getMasterVocabulary(self):
-        return self._master
-
-    def queryForPrefix(self, prefix):
-        # Never nest more than one level; cause the real
-        # master to always be returned by getMasterVocabulary()
-        return SubsetCompletionVocabulary(self._match_prefix(prefix),
-                                          self._master)


=== Zope3/src/zope/schema/tests/test_tabcomplete.py 1.3 => 1.4 ===
--- Zope3/src/zope/schema/tests/test_tabcomplete.py:1.3	Tue Jun  3 18:46:28 2003
+++ Zope3/src/zope/schema/tests/test_tabcomplete.py	Wed Jun 18 15:02:46 2003
@@ -29,11 +29,9 @@
         subset = self.vocab.queryForPrefix("a")
         L = [term.value for term in subset]
         self.assertEqual(L, ["abc"])
-        self.assert_(subset.getMasterVocabulary() is self.vocab)
         subset = self.vocab.queryForPrefix("def")
         L = [term.value for term in subset]
         self.assertEqual(L, ["def"])
-        self.assert_(subset.getMasterVocabulary() is self.vocab)
 
     def test_failed_query(self):
         self.assertRaises(LookupError, self.vocab.queryForPrefix, "g")