[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_vocabularywidget.py:1.14
Gary Poster
gary@zope.com
Tue, 3 Jun 2003 10:16:13 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv27277/tests
Modified Files:
test_vocabularywidget.py
Log Message:
change haveData to have correct semantics. refactor a bit.
=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.13 Mon Jun 2 14:01:28 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py Tue Jun 3 10:16:11 2003
@@ -316,7 +316,7 @@
bound = self.makeField(BasicVocabulary(["splat", "foobar"]))
w = getView(bound, "edit", self.makeRequest())
w.setData(bound.context.f)
- self.assert_(w.haveData())
+ self.assert_(not w.haveData())
self.verifyResult(w(), [
'selected="selected"',
'id="field.f"',
@@ -352,8 +352,10 @@
# report haveData() properly.
bound = self.makeField(BasicVocabulary(["splat", "foobar"]))
bound.context.f = "splat"
- w = getView(bound, "edit", self.makeRequest())
+ w = getView(bound, "edit", self.makeRequest(
+ 'field.f-empty-marker='))
self.assert_(w.haveData())
+ self.assertEqual(w.getData(), None) # XXX might be []...
class SingleSelectionTests(SingleSelectionTestsBase):
"""Test single-selection with the selection-box widget."""
@@ -393,7 +395,7 @@
["foobar", "frob"])
w = getView(bound, "display", self.makeRequest())
w.setData(bound.context.f)
- self.assert_(w.haveData())
+ self.assert_(not w.haveData())
self.verifyResult(w(), [
'<ol',
'id="field.f"',
@@ -432,7 +434,7 @@
def test_edit(self):
bound = self.makeField(BasicVocabulary(["splat", "foobar", "frob"]))
w = getView(bound, "edit", self.makeRequest())
- self.assert_(w.haveData())
+ self.assert_(not w.haveData())
self.verifyResult(w(), [
'id="field.f"',
'name="field.f:list"',
@@ -561,4 +563,4 @@
return suite
if __name__ == '__main__':
- unittest.main()
+ unittest.main(defaultTest="test_suite")