[Zope3-checkins] SVN: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/ Some cleanups.

Martijn Faassen faassen at startifact.com
Sat Jan 2 14:04:24 EST 2010


Log message for revision 107570:
  Some cleanups.
  

Changed:
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/functionalsupport.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_datewidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_datetimewidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_decimalwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_filewidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_floatwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_intwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_objectwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textareawidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_intwidget.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_registrations.py
  U   zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_sequencewidget.py

-=-
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/functionalsupport.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/functionalsupport.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/functionalsupport.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -11,14 +11,10 @@
 from zope.formlib.interfaces import (
     IInputWidget, IForm,
     IWidgetInputError, IWidgetInputErrorView)
-from zope.formlib.tests.support import patternExists
 from zope.formlib.tests.test_formlib import requestToTZInfo
-from zope.formlib.widgets import BooleanRadioWidget
 from zope.i18n.testing import setUp as i18nSetUp
-from zope.interface import Interface, implements, Invalid
-from zope.publisher.browser import TestRequest
+from zope.interface import Invalid
 from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.schema import Bool
 import unittest
 import zope.i18n
 import zope.schema.interfaces

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_datewidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_datewidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_datewidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -18,7 +18,6 @@
 import datetime
 import unittest
 import doctest
-from zope.datetime import parseDatetimetz
 from zope.schema import Date
 from zope.interface.verify import verifyClass
 

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_datetimewidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_datetimewidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_datetimewidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -24,7 +24,6 @@
 from zope.schema import Datetime, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
-from zope.formlib.tests.support import patternExists
 from zope.formlib.widgets import DatetimeWidget, DropdownWidget, ChoiceInputWidget
 from zope.formlib.tests.functionalsupport import FunctionalWidgetTestCase
 import zope.schema.interfaces
@@ -182,7 +181,6 @@
         request.form['form.actions.apply'] = u''
         html = Form(foo, request)()
 
-        d1_index = html.find('form.d1')
         self.assert_(html.find('Value is too big') != -1)
         d2_index = html.find('form.d2')
         self.assert_(html.find('Value is too big', d2_index) == -1)

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_decimalwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_decimalwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_decimalwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -95,7 +95,7 @@
         request.form['form.f2'] = '2.23456789012345'
         request.form['form.f3'] = '11.1'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new values in object
         self.assertEqual(foo.f1, decimal.Decimal("1.123"))
@@ -110,7 +110,7 @@
         request.form['form.f2'] = ''
         request.form['form.f3'] = '1.1'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new values in object
         self.assertEqual(foo.f1, None)
@@ -184,7 +184,7 @@
         # field f1 is omitted, which should not cause a validation error
         request.form['form.f2'] = ''
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new value in object
         self.assert_(foo.f1 is None)

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_filewidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_filewidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_filewidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -17,20 +17,15 @@
 """
 import unittest
 
-import re
-from datetime import datetime
-
 from StringIO import StringIO
 from zope.interface import Interface, implements
-from zope.schema import Datetime, Choice, Field
+from zope.schema import Field
 from zope.schema.interfaces import IField
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
 from zope.formlib.tests.support import patternExists
 from zope.formlib.widgets import FileWidget
 from zope.formlib.tests.functionalsupport import FunctionalWidgetTestCase
-import zope.schema.interfaces
-from zope.datetime import parseDatetimetz, tzinfo
 
 class IFileField(IField):
     """Field for representing a file that can be edited by FileWidget."""
@@ -144,7 +139,7 @@
         # or else it will complain (see test_required_validation) and the
         # change will not succeed.
         
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # new value for f1 should be field.missing_value (i.e, None)
         self.assert_(foo.f1 is None)

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_floatwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_floatwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_floatwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -91,7 +91,7 @@
         request.form['form.f2'] = '2.23456789012345'
         request.form['form.f3'] = '11.1'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
         
         # check new values in object
         self.assertEqual(foo.f1, 1.123)
@@ -107,7 +107,7 @@
         request.form['form.f2'] = ''
         request.form['form.f3'] = '1.1'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
  
         # check new values in object
         self.assertEqual(foo.f1, None)
@@ -126,8 +126,6 @@
         html = Form(foo, request)()
 
         # confirm error msgs
-        f1_index = html.find('form.f1')
-        f2_index =  html.find('form.f2')
         f3_index = html.find('form.f3')
         missing_index = html.find('missing')
         self.assert_(missing_index > f3_index)
@@ -176,7 +174,7 @@
         # field f1 is omitted, which should not cause a validation error
         request.form['form.f2'] = ''
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new value in object
         self.assert_(foo.f1 is None)

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_intwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_intwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_intwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -17,13 +17,8 @@
 """
 import unittest
 
-import re
-from datetime import datetime
-
-from StringIO import StringIO
 from zope.interface import Interface, implements
 from zope.schema import Int, Choice
-from zope.schema.interfaces import IField
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
 from zope.formlib.tests.support import patternExists
@@ -32,7 +27,6 @@
     DropdownWidget, ChoiceInputWidget)
 from zope.formlib.tests.functionalsupport import FunctionalWidgetTestCase
 import zope.schema.interfaces
-from zope.datetime import parseDatetimetz, tzinfo
 
 class IIntTest(Interface):
     i1 = Int(
@@ -117,7 +111,7 @@
         request.form['form.i3'] = '3'
         request.form['form.actions.apply'] = u''
         
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new values in object
         self.assertEqual(foo.i1, 1)
@@ -134,7 +128,7 @@
         request.form['form.i3-empty-marker'] = ''
         request.form['form.actions.apply'] = u''
         
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new values in object
         self.assertEqual(foo.i1, 1)
@@ -235,7 +229,7 @@
         request.form['form.i2'] = ''
         request.form['form.actions.apply'] = u''
         
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new value in object
         self.assert_(foo.i1 is None)

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_objectwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_objectwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_objectwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -23,12 +23,10 @@
 from zope.traversing.adapters import DefaultTraversable
 from zope.component.testing import PlacelessSetup
 from zope.interface import Interface, implements
-from zope.schema import TextLine, Object, Choice
+from zope.schema import TextLine, Object
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
-from zope.formlib.tests.support import patternExists
-from zope.formlib.widgets import TextWidget, ObjectWidget
-from zope.formlib.tests.functionalsupport import FunctionalWidgetTestCase
+from zope.formlib.widgets import ObjectWidget
 from zope.formlib.tests.support import VerifyResults
 import zope.schema.interfaces
 from zope.traversing.testing import setUp as traversingSetUp
@@ -55,8 +53,8 @@
         # simpler way to publish widget_macros.pt? Probably.
         
         # load the registrations for formlib
-        context = xmlconfig.file("configure.zcml",
-                                 zope.formlib)
+        xmlconfig.file("configure.zcml",
+                       zope.formlib)
 
         # set up the widget_macros macro
         macro_template = PageTemplate()

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textareawidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textareawidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textareawidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -17,7 +17,6 @@
 """
 import unittest
 
-import decimal
 from zope.interface import Interface, implements
 from zope.schema import Text
 from zope.formlib import form
@@ -83,7 +82,7 @@
         request.form['form.s3'] = u'baz'
         request.form['form.actions.apply'] = u''
 
-        html = Form(foo, request)()
+        Form(foo, request)()
         
         # check new values in object
         self.assertEqual(foo.s1, u'foo')
@@ -119,7 +118,7 @@
         request.form['form.s3'] = ''
         request.form['form.actions.apply'] = u''
 
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new value in object
         self.assertEqual(foo.s1, u'foo')
@@ -177,7 +176,7 @@
         request.form['form.s2'] = u'bar'
         request.form['form.actions.apply'] = u''
 
-        html = Form(foo, request)()
+        Form(foo, request)()
         
         # check new values in object
         self.assertEqual(foo.s1, '')

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_functional_textwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -91,7 +91,7 @@
         request.form['form.s2'] = u'bar'
         request.form['form.s3'] = u'Uncle'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new values in object
         self.assertEqual(foo.s1, u'foo')
@@ -124,7 +124,7 @@
         request.form['form.s2'] = u''
         request.form['form.s3'] = u''
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
         
         # check new values in object
         self.assertEqual(foo.s1, u'foo')
@@ -194,7 +194,7 @@
         # field s1 is omitted, which should not cause a validation error
         request.form['form.s2'] = u'bar'
         request.form['form.actions.apply'] = u''
-        html = Form(foo, request)()
+        Form(foo, request)()
 
         # check new value in object
         self.assertEqual(foo.s1, '')

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_intwidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_intwidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_intwidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -17,7 +17,6 @@
 """
 import unittest
 import doctest
-from unittest import main, makeSuite
 from zope.formlib.tests.test_browserwidget import SimpleInputWidgetTest
 from zope.formlib.interfaces import IInputWidget
 from zope.formlib.widgets import IntWidget

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_registrations.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_registrations.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_registrations.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -54,8 +54,8 @@
 
 def setUp(test):
     testing.setUp()
-    context = xmlconfig.file("tests/registerWidgets.zcml",
-                             zope.formlib)
+    xmlconfig.file("tests/registerWidgets.zcml",
+                   zope.formlib)
 
 class Tests(object):
     """Documents and tests widgets registration for specific field types.

Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_sequencewidget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_sequencewidget.py	2010-01-02 18:47:35 UTC (rev 107569)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests/test_sequencewidget.py	2010-01-02 19:04:23 UTC (rev 107570)
@@ -290,9 +290,8 @@
             'field.foo.count': u'2'})
         widget = TupleSequenceWidget(
             self.field, self.field.value_type, request)
-        s = widget()
         # Rendering a widget should not raise errors!
-        result = widget()
+        widget()
 
         data = widget._generateSequence()
         self.assertEquals(data, [None, u'nonempty'])



More information about the Zope3-Checkins mailing list