[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests -
test_sequencewidget.py:1.6
Philipp von Weitershausen
philikon at philikon.de
Mon Jan 5 06:24:59 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv7429/tests
Modified Files:
test_sequencewidget.py
Log Message:
Simplify boolean assertions.
=== Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py:1.5 Fri Nov 21 12:11:56 2003
+++ Zope3/src/zope/app/browser/form/tests/test_sequencewidget.py Mon Jan 5 06:24:58 2004
@@ -54,23 +54,23 @@
self.field = List(__name__=u'foo', value_type=TextLine(__name__=u'bar'))
request = TestRequest()
widget = ListSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 0)
+ self.failIf(widget.hasInput())
self.assertEquals(widget.getInputValue(), [])
request = TestRequest(form={'field.foo.add': u'Add bar'})
widget = ListSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertRaises(ValidationError, widget.getInputValue)
request = TestRequest(form={'field.foo.0.bar': u'Hello world!'})
widget = ListSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertEquals(widget.getInputValue(), [u'Hello world!'])
def test_new(self):
request = TestRequest()
widget = TupleSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 0)
+ self.failIf(widget.hasInput())
self.assertEquals(widget.getInputValue(), ())
check_list = ('input', 'name="field.foo.add"')
self.verifyResult(widget(), check_list)
@@ -78,7 +78,7 @@
def test_add(self):
request = TestRequest(form={'field.foo.add': u'Add bar'})
widget = TupleSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertRaises(ValidationError, widget.getInputValue)
check_list = (
'checkbox', 'field.foo.remove_0', 'input', 'field.foo.0.bar',
@@ -89,14 +89,14 @@
def test_request(self):
request = TestRequest(form={'field.foo.0.bar': u'Hello world!'})
widget = TupleSequenceWidget(self.field, request)
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertEquals(widget.getInputValue(), (u'Hello world!',))
def test_existing(self):
request = TestRequest()
widget = TupleSequenceWidget(self.field, request)
widget.setRenderedValue((u'existing',))
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertEquals(widget.getInputValue(), (u'existing',))
check_list = (
'checkbox', 'field.foo.remove_0', 'input', 'field.foo.0.bar',
@@ -105,7 +105,7 @@
)
self.verifyResult(widget(), check_list, inorder=True)
widget.setRenderedValue((u'existing', u'second'))
- self.assertEquals(int(widget.hasInput()), 1)
+ self.assert_(widget.hasInput())
self.assertEquals(widget.getInputValue(), (u'existing', u'second'))
check_list = (
'checkbox', 'field.foo.remove_0', 'input', 'field.foo.0.bar',
More information about the Zope3-Checkins
mailing list