[Zope3-checkins] CVS: Zope3/src/zope/app/form/browser/ftests - test_datetimewidget.py:1.4 test_filewidget.py:1.4 test_floatwidget.py:1.4 test_intwidget.py:1.4 test_textwidget.py:1.4 test_registrations.py:NONE

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Apr 24 19:20:14 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/form/browser/ftests
In directory cvs.zope.org:/tmp/cvs-serv30169/src/zope/app/form/browser/ftests

Modified Files:
	test_datetimewidget.py test_filewidget.py test_floatwidget.py 
	test_intwidget.py test_textwidget.py 
Removed Files:
	test_registrations.py 
Log Message:


Removed Enumerated widgets. Refactored vocabulary widgets to be views of
fields and vocabularies. Updated tests.




=== Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py:1.3	Sun Apr 11 06:34:56 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_datetimewidget.py	Sat Apr 24 19:19:43 2004
@@ -25,8 +25,7 @@
 from zope.interface import Interface
 from zope.interface import implements
 
-from zope.schema import Datetime
-from zope.schema import EnumeratedDatetime
+from zope.schema import Datetime, Choice
 
 from support import *
 from zope.app.traversing import traverse
@@ -44,9 +43,9 @@
     d2 = Datetime(
         required=False)
 
-    d3 = EnumeratedDatetime(
+    d3 = Choice(
         required=False,
-        allowed_values=(
+        values=(
             datetime(2003, 9, 15, tzinfo=tzinfo(0)),
             datetime(2003, 10, 15, tzinfo=tzinfo(0))),
         missing_value=datetime(2000, 1, 1, tzinfo=tzinfo(0)))
@@ -142,7 +141,7 @@
         response = self.publish('/test/edit.html', form={
             'UPDATE_SUBMIT' : '',
             'field.d2' : '',
-            'field.d3' : '' })
+            'field.d3-empty-marker' : '' })
         self.assertEqual(response.getStatus(), 200)
         self.assert_(updatedMsgExists(response.getBody()))
 


=== Zope3/src/zope/app/form/browser/ftests/test_filewidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/ftests/test_filewidget.py:1.3	Tue Apr  6 16:58:08 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_filewidget.py	Sat Apr 24 19:19:43 2004
@@ -24,8 +24,8 @@
 from zope.interface import Interface
 from zope.interface import implements
 
-from zope.schema.interfaces import IField, IEnumerated
-from zope.schema import Field, Enumerated
+from zope.schema.interfaces import IField
+from zope.schema import Field
 
 from zope.app.form.browser.textwidgets import FileWidget
 
@@ -35,11 +35,11 @@
 from zope.app.tests.functional import BrowserTestCase
 from zope.app.form.interfaces import IInputWidget
 
-class IFileField(IEnumerated, IField):
+class IFileField(IField):
     """Field for representing a file that can be edited by FileWidget."""
 
 
-class FileField(Enumerated, Field):
+class FileField(Field):
 
     implements(IFileField)
 


=== Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py:1.3	Sun Apr 11 06:34:56 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_floatwidget.py	Sat Apr 24 19:19:43 2004
@@ -25,8 +25,7 @@
 from zope.interface import Interface
 from zope.interface import implements
 
-from zope.schema import Float
-from zope.schema import EnumeratedFloat
+from zope.schema import Float, Choice
 
 from zope.app.traversing import traverse
 
@@ -43,9 +42,9 @@
     f2 = Float(
         required=False)
 
-    f3 = EnumeratedFloat(
+    f3 = Choice(
         required=False,
-        allowed_values=(0.0, 1.1, 2.1, 3.1, 5.1, 7.1, 11.1),
+        values=(0.0, 1.1, 2.1, 3.1, 5.1, 7.1, 11.1),
         missing_value=0)
 
 registerEditForm(IFloatTest)
@@ -82,9 +81,10 @@
 
         # f3 should be in a dropdown
         self.assert_(patternExists(
-            '<select .* name="field.f3".*>', response.getBody()))
+            '<select .*name="field.f3".*>', response.getBody()))
         self.assert_(patternExists(
-            '<option value="2.1" selected>2.1</option>', response.getBody()))
+            '<option selected="selected" value="2.1">2.1</option>',
+            response.getBody()))
 
 
     def test_submit_editform(self):
@@ -117,7 +117,7 @@
             'UPDATE_SUBMIT' : '',
             'field.f1' : '1.1',
             'field.f2' : '',
-            'field.f3' : '' })
+            'field.f3-empty-marker' : '1' })
         self.assertEqual(response.getStatus(), 200)
         self.assert_(updatedMsgExists(response.getBody()))
 


=== Zope3/src/zope/app/form/browser/ftests/test_intwidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/ftests/test_intwidget.py:1.3	Sun Apr 11 06:34:56 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_intwidget.py	Sat Apr 24 19:19:43 2004
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 import unittest
 from persistence import Persistent
 from transaction import get_transaction
@@ -25,8 +24,7 @@
 from zope.interface import Interface
 from zope.interface import implements
 
-from zope.schema import Int
-from zope.schema import EnumeratedInt
+from zope.schema import Int, Choice
 
 from zope.app.traversing import traverse
 
@@ -43,9 +41,9 @@
     i2 = Int(
         required=False)
 
-    i3 = EnumeratedInt(
+    i3 = Choice(
         required=False,
-        allowed_values=(0, 1, 2, 3, 5, 7, 11),
+        values=(0, 1, 2, 3, 5, 7, 11),
         missing_value=0)
 
 registerEditForm(IIntTest)
@@ -55,10 +53,10 @@
     """Used to test an unusual care where missing_value is -1 and
     not in allowed_values."""
 
-    i1 = EnumeratedInt(
+    i1 = Choice(
         required=False,
         missing_value=-1,
-        allowed_values=(10, 20, 30))
+        values=(10, 20, 30))
 
 registerEditForm(IIntTest2)
 
@@ -104,9 +102,10 @@
 
         # i3 should be in a dropdown
         self.assert_(patternExists(
-            '<select .* name="field.i3".*>', response.getBody()))
+            '<select .*name="field.i3".*>', response.getBody()))
         self.assert_(patternExists(
-            '<option value="2" selected>2</option>', response.getBody()))
+            '<option selected="selected" value="2">2</option>',
+            response.getBody()))
 
 
     def test_submit_editform(self):
@@ -139,7 +138,7 @@
             'UPDATE_SUBMIT' : '',
             'field.i1' : '1',
             'field.i2' : '',
-            'field.i3' : '' })
+            'field.i3-empty-marker' : '' })
         self.assertEqual(response.getStatus(), 200)
         self.assert_(updatedMsgExists(response.getBody()))
 
@@ -165,16 +164,17 @@
 
         # confirm that i1 is has a blank item at top with value=""
         self.assert_(patternExists(
-            '<select .* name="field.i1".*>', response.getBody()))
+            '<select name="field.i1" .*>', response.getBody()))
         self.assert_(patternExists(
-            '<option value=""></option>', response.getBody()))
+            '<option value="">.*</option>', response.getBody()))
         self.assert_(patternExists(
-            '<option value="10" selected>10</option>', response.getBody()))
+            '<option selected="selected" value="10">10</option>',
+            response.getBody()))
 
         # submit form as if top item is selected
         response = self.publish('/test/edit.html', form={
             'UPDATE_SUBMIT' : '',
-            'field.i1' : '' })
+            'field.i1-empty-marker' : '1'})
 
         self.assertEqual(response.getStatus(), 200)
         self.assert_(updatedMsgExists(response.getBody()))


=== Zope3/src/zope/app/form/browser/ftests/test_textwidget.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/ftests/test_textwidget.py:1.3	Sun Apr 11 06:34:56 2004
+++ Zope3/src/zope/app/form/browser/ftests/test_textwidget.py	Sat Apr 24 19:19:43 2004
@@ -20,7 +20,7 @@
 from transaction import get_transaction
 
 from zope.interface import Interface, implements
-from zope.schema import TextLine, EnumeratedTextLine
+from zope.schema import TextLine, Choice
 
 from support import *
 from zope.app.traversing import traverse
@@ -39,9 +39,9 @@
         required=False,
         missing_value=u'')
 
-    s3 = EnumeratedTextLine(
+    s3 = Choice(
         required=False,
-        allowed_values=(u'Bob', u'is', u'Your', u'Uncle'))
+        values=(u'Bob', u'is', u'Your', u'Uncle'))
 
 registerEditForm(ITextLineTest)
 
@@ -76,9 +76,9 @@
 
         # s3 should be in a dropdown
         self.assert_(patternExists(
-            '<select .* name="field.s3".*>', response.getBody()))
+            '<select .*name="field.s3".*>', response.getBody()))
         self.assert_(patternExists(
-            '<option value="" selected></option>', response.getBody()))
+            '<option value="">.*</option>', response.getBody()))
 
 
     def test_submit_editform(self):

=== Removed File Zope3/src/zope/app/form/browser/ftests/test_registrations.py ===




More information about the Zope3-Checkins mailing list