[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_vocabularywidget.py:1.1.2.10
Fred L. Drake, Jr.
fred@zope.com
Tue, 6 May 2003 14:20:46 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv13839
Modified Files:
Tag: schema-vocabulary-branch
test_vocabularywidget.py
Log Message:
- rename _verifyResult() to verifyResult()
- move definition adjacent to other helper method
=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.1.2.9 => 1.1.2.10 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.1.2.9 Tue May 6 14:16:24 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py Tue May 6 14:20:46 2003
@@ -87,12 +87,6 @@
class VocabularyWidgetTests(PlacelessSetup, unittest.TestCase):
- # modified from test_browserwidget.BrowserWidgetTest:
- def _verifyResult(self, result, check_list):
- for check in check_list:
- self.assert_(result.find(check) >= 0,
- "%r not found in %r" % (check, result))
-
def setUp(self):
PlacelessSetup.setUp(self)
# This is equivalent to the default configuration for
@@ -145,6 +139,12 @@
field = cls(vocabulary=vocabulary, __name__="f")
return field.bind(SampleContent(value))
+ # modified from test_browserwidget.BrowserWidgetTest:
+ def verifyResult(self, result, check_list):
+ for check in check_list:
+ self.assert_(result.find(check) >= 0,
+ "%r not found in %r" % (check, result))
+
def test_field_indirection(self):
bound = self.makeField(vocabulary.VocabularyField, SampleVocabulary())
w = getView(bound, "display", TestRequest())
@@ -177,7 +177,7 @@
bound = self.makeField(vocabulary.VocabularyField, vocab)
w = getView(bound, "edit", TestRequest())
self.assert_(not w.haveData())
- self._verifyResult(w(), [
+ self.verifyResult(w(), [
'selected="selected"',
'id="field.f"',
'name="field.f"',
@@ -188,12 +188,12 @@
'>foobar<',
])
s1, s2 = w.renderItems("foobar")
- self._verifyResult(s1, [
+ self.verifyResult(s1, [
'value="splat"',
'>splat<',
])
self.assert_(s1.find('selected') < 0)
- self._verifyResult(s2, [
+ self.verifyResult(s2, [
'selected="selected"',
'value="foobar"',
'>foobar<',
@@ -208,7 +208,7 @@
self.assert_(w.haveData())
self.assertEqual(w._showData(), "foobar")
self.assert_(isinstance(w, widget.VocabularyEditWidget))
- self._verifyResult(w.hidden(), [
+ self.verifyResult(w.hidden(), [
'<input',
'id="field.f"',
'name="field.f"',
@@ -221,7 +221,7 @@
None)
w = getView(bound, "display", TestRequest())
self.assert_(not w.haveData())
- self._verifyResult(w(), [
+ self.verifyResult(w(), [
'<span',
'id="field.f"',
'name="field.f"',
@@ -235,7 +235,7 @@
["foobar", "frob"])
w = getView(bound, "display", TestRequest())
self.assert_(not w.haveData())
- self._verifyResult(w(), [
+ self.verifyResult(w(), [
'<ol',
'id="field.f"',
'name="field.f"',
@@ -245,7 +245,7 @@
w.cssClass = 'test'
items = w.renderItems(['foobar'])
self.assertEqual(len(items), 1)
- self._verifyResult(items[0], [
+ self.verifyResult(items[0], [
'<li',
'class="test-item"',
'>foobar<',
@@ -261,7 +261,7 @@
w = getView(bound, "display", request)
self.assert_(w.haveData())
s = w()
- self._verifyResult(s, [
+ self.verifyResult(s, [
'<ol',
'id="field.f"',
'name="field.f"',
@@ -279,7 +279,7 @@
BasicVocabulary(["splat", "foobar", "frob"]))
w = getView(bound, "edit", TestRequest())
self.assert_(not w.haveData())
- self._verifyResult(w(), [
+ self.verifyResult(w(), [
'id="field.f"',
'name="field.f:list"',
'class="vocabularyType"',
@@ -291,17 +291,17 @@
'>frob<',
])
s1, s2, s3 = w.renderItems(w._missing)
- self._verifyResult(s1, [
+ self.verifyResult(s1, [
'value="splat"',
'>splat<',
])
self.assert_(s1.find('selected') < 0)
- self._verifyResult(s2, [
+ self.verifyResult(s2, [
'value="foobar"',
'>foobar<',
])
self.assert_(s2.find('selected') < 0)
- self._verifyResult(s3, [
+ self.verifyResult(s3, [
'value="frob"',
'>frob<',
])
@@ -318,7 +318,7 @@
L = w._showData()
L.sort()
self.assertEqual(L, ["foobar", "splat"])
- self._verifyResult(w.hidden(), [
+ self.verifyResult(w.hidden(), [
'<input',
'type="hidden"',
'name="field.f:list"',