[Zope3-checkins] CVS: Zope3/lib/python/Zope/Schema/tests - testBoolField.py:1.3 testDictField.py:1.3 testField.py:1.3 testFloatField.py:1.3 testIntField.py:1.3 testListField.py:1.3 testSchema.py:1.4 testStrField.py:1.4 testTupleField.py:1.3
Jim Fulton
jim@zope.com
Wed, 18 Sep 2002 11:05:52 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Schema/tests
In directory cvs.zope.org:/tmp/cvs-serv23268/lib/python/Zope/Schema/tests
Modified Files:
testBoolField.py testDictField.py testField.py
testFloatField.py testIntField.py testListField.py
testSchema.py testStrField.py testTupleField.py
Log Message:
Updated uses of Boolean fields to use True and False (rather than 1 and 0).
=== Zope3/lib/python/Zope/Schema/tests/testBoolField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testBoolField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testBoolField.py Wed Sep 18 11:05:51 2002
@@ -23,18 +23,16 @@
def testValidate(self):
field = Bool(title=u'Bool field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
- field.validate(1)
- field.validate(0)
- field.validate(10)
- field.validate(-10)
+ field.validate(True)
+ field.validate(False)
def testValidateRequired(self):
field = Bool(title=u'Bool field', description=u'',
- readonly=0, required=1)
- field.validate(1)
- field.validate(0)
+ readonly=False, required=True)
+ field.validate(True)
+ field.validate(False)
self.assertRaisesErrorNames(ErrorNames.RequiredMissing,
field.validate, None)
=== Zope3/lib/python/Zope/Schema/tests/testDictField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testDictField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testDictField.py Wed Sep 18 11:05:51 2002
@@ -23,7 +23,7 @@
def testValidate(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0)
+ description=u'', readonly=False, required=False)
field.validate(None)
field.validate({})
field.validate({1: 'foo'})
@@ -31,7 +31,7 @@
def testValidateRequired(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=1)
+ description=u'', readonly=False, required=True)
field.validate({})
field.validate({1: 'foo'})
field.validate({'a': 1})
@@ -41,7 +41,7 @@
def testValidateMinValues(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0,
+ description=u'', readonly=False, required=False,
min_length=1)
field.validate(None)
field.validate({1: 'a'})
@@ -52,7 +52,7 @@
def testValidateMaxValues(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0,
+ description=u'', readonly=False, required=False,
max_length=1)
field.validate(None)
field.validate({})
@@ -65,7 +65,7 @@
def testValidateMinValuesAndMaxValues(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0,
+ description=u'', readonly=False, required=False,
min_length=1, max_length=2)
field.validate(None)
field.validate({1: 'a'})
@@ -78,7 +78,7 @@
def testValidateValueTypes(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0,
+ description=u'', readonly=False, required=False,
value_types=(Int(), Float()))
field.validate(None)
field.validate({'a': 5.3})
@@ -91,7 +91,7 @@
def testValidateKeyTypes(self):
field = Dict(title=u'Dict field',
- description=u'', readonly=0, required=0,
+ description=u'', readonly=False, required=False,
key_types=(Int(), Float()))
field.validate(None)
field.validate({5.3: 'a'})
=== Zope3/lib/python/Zope/Schema/tests/testField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testField.py Wed Sep 18 11:05:51 2002
@@ -34,7 +34,7 @@
def testValidate(self):
field = Field(title=u'Not required field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate('foo')
field.validate(1)
@@ -43,7 +43,7 @@
def testValidateRequired(self):
field = Field(title=u'Required field', description=u'',
- readonly=0, required=1)
+ readonly=False, required=True)
field.validate('foo')
field.validate(1)
field.validate(0)
=== Zope3/lib/python/Zope/Schema/tests/testFloatField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testFloatField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testFloatField.py Wed Sep 18 11:05:51 2002
@@ -23,7 +23,7 @@
def testValidate(self):
field = Float(title=u'Float field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate(10.0)
field.validate(0.93)
@@ -31,7 +31,7 @@
def testValidateRequired(self):
field = Float(title=u'Float field', description=u'',
- readonly=0, required=1)
+ readonly=False, required=True)
field.validate(10.0)
field.validate(0.93)
field.validate(1000.0003)
@@ -40,7 +40,8 @@
field.validate, None)
def testAllowedValues(self):
field = Float(title=u'Integer field', description=u'',
- readonly=0, required=0, allowed_values=(0.1, 2.6))
+ readonly=False, required=False,
+ allowed_values=(0.1, 2.6))
field.validate(None)
field.validate(2.6)
@@ -49,7 +50,7 @@
def testValidateMin(self):
field = Float(title=u'Float field', description=u'',
- readonly=0, required=0, min=10.5)
+ readonly=False, required=False, min=10.5)
field.validate(None)
field.validate(10.6)
field.validate(20.2)
@@ -59,7 +60,7 @@
def testValidateMax(self):
field = Float(title=u'Float field', description=u'',
- readonly=0, required=0, max=10.5)
+ readonly=False, required=False, max=10.5)
field.validate(None)
field.validate(5.3)
field.validate(-9.1)
@@ -69,7 +70,7 @@
def testValidateMinAndMax(self):
field = Float(title=u'Float field', description=u'',
- readonly=0, required=0, min=-0.6, max=10.1)
+ readonly=False, required=False, min=-0.6, max=10.1)
field.validate(None)
field.validate(0.0)
field.validate(-0.03)
=== Zope3/lib/python/Zope/Schema/tests/testIntField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testIntField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testIntField.py Wed Sep 18 11:05:51 2002
@@ -23,7 +23,7 @@
def testValidate(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate(10)
field.validate(0)
@@ -31,7 +31,7 @@
def testValidateRequired(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=1)
+ readonly=False, required=True)
field.validate(10)
field.validate(0)
field.validate(-1)
@@ -41,7 +41,7 @@
def testAllowedValues(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=0, allowed_values=(-1, 2))
+ readonly=False, required=False, allowed_values=(-1, 2))
field.validate(None)
field.validate(2)
@@ -50,7 +50,7 @@
def testValidateMin(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=0, min=10)
+ readonly=False, required=False, min=10)
field.validate(None)
field.validate(10)
field.validate(20)
@@ -60,7 +60,7 @@
def testValidateMax(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=0, max=10)
+ readonly=False, required=False, max=10)
field.validate(None)
field.validate(5)
field.validate(9)
@@ -70,7 +70,7 @@
def testValidateMinAndMax(self):
field = Int(title=u'Int field', description=u'',
- readonly=0, required=0, min=0, max=10)
+ readonly=False, required=False, min=0, max=10)
field.validate(None)
field.validate(0)
field.validate(5)
=== Zope3/lib/python/Zope/Schema/tests/testListField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testListField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testListField.py Wed Sep 18 11:05:51 2002
@@ -23,7 +23,7 @@
def testValidate(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate([])
field.validate([1, 2])
@@ -31,7 +31,7 @@
def testValidateRequired(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=1)
+ readonly=False, required=True)
field.validate([])
field.validate([1, 2])
field.validate([3,])
@@ -41,7 +41,7 @@
def testValidateMinValues(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=0, min_length=2)
+ readonly=False, required=False, min_length=2)
field.validate(None)
field.validate([1, 2])
field.validate([1, 2, 3])
@@ -53,7 +53,7 @@
def testValidateMaxValues(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=0, max_length=2)
+ readonly=False, required=False, max_length=2)
field.validate(None)
field.validate([])
field.validate([1, 2])
@@ -65,7 +65,8 @@
def testValidateMinValuesAndMaxValues(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=0, min_length=1, max_length=2)
+ readonly=False, required=False,
+ min_length=1, max_length=2)
field.validate(None)
field.validate([1, ])
field.validate([1, 2])
@@ -77,7 +78,8 @@
def testValidateValueTypes(self):
field = List(title=u'List field', description=u'',
- readonly=0, required=0, value_types=(Int(), Float()))
+ readonly=False, required=False,
+ value_types=(Int(), Float()))
field.validate(None)
field.validate([5.3,])
field.validate([2, 2.3])
=== Zope3/lib/python/Zope/Schema/tests/testSchema.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/Schema/tests/testSchema.py:1.3 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testSchema.py Wed Sep 18 11:05:51 2002
@@ -26,19 +26,19 @@
title=u"Title",
description=u"Title",
default="",
- required=1)
+ required=True)
description = Bytes(
title=u"Description",
description=u"Description",
default="",
- required=1)
+ required=True)
spam = Bytes(
title=u"Spam",
description=u"Spam",
default="",
- required=1)
+ required=True)
class SchemaTest(TestCase):
=== Zope3/lib/python/Zope/Schema/tests/testStrField.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/Schema/tests/testStrField.py:1.3 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testStrField.py Wed Sep 18 11:05:51 2002
@@ -24,7 +24,7 @@
def testValidate(self):
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate(self._convert('foo'))
field.validate(self._convert(''))
@@ -35,7 +35,7 @@
# we need to set the min-length to 1.
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=1, min_length=1)
+ readonly=False, required=True, min_length=1)
field.validate(self._convert('foo'))
self.assertRaisesErrorNames(ErrorNames.RequiredMissing,
@@ -45,7 +45,7 @@
def testAllowedValues(self):
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=0,
+ readonly=False, required=False,
allowed_values=(self._convert('foo'),
self._convert('bar')))
field.validate(None)
@@ -56,7 +56,7 @@
def testValidateMinLength(self):
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=0, min_length=3)
+ readonly=False, required=False, min_length=3)
field.validate(None)
field.validate(self._convert('333'))
field.validate(self._convert('55555'))
@@ -70,7 +70,7 @@
def testValidateMaxLength(self):
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=0, max_length=5)
+ readonly=False, required=False, max_length=5)
field.validate(None)
field.validate(self._convert(''))
field.validate(self._convert('333'))
@@ -83,7 +83,8 @@
def testValidateMinLengthAndMaxLength(self):
field = self._Str(title=u'Str field', description=u'',
- readonly=0, required=0, min_length=3, max_length=5)
+ readonly=False, required=False,
+ min_length=3, max_length=5)
field.validate(None)
field.validate(self._convert('333'))
=== Zope3/lib/python/Zope/Schema/tests/testTupleField.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Schema/tests/testTupleField.py:1.2 Wed Sep 11 18:06:41 2002
+++ Zope3/lib/python/Zope/Schema/tests/testTupleField.py Wed Sep 18 11:05:51 2002
@@ -23,7 +23,7 @@
def testValidate(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=0)
+ readonly=False, required=False)
field.validate(None)
field.validate(())
field.validate((1, 2))
@@ -31,7 +31,7 @@
def testValidateRequired(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=1)
+ readonly=False, required=True)
field.validate(())
field.validate((1, 2))
field.validate((3,))
@@ -41,7 +41,7 @@
def testValidateMinValues(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=0, min_length=2)
+ readonly=False, required=False, min_length=2)
field.validate(None)
field.validate((1, 2))
field.validate((1, 2, 3))
@@ -53,7 +53,7 @@
def testValidateMaxValues(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=0, max_length=2)
+ readonly=False, required=False, max_length=2)
field.validate(None)
field.validate(())
field.validate((1, 2))
@@ -65,7 +65,8 @@
def testValidateMinValuesAndMaxValues(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=0, min_length=1, max_length=2)
+ readonly=False, required=False,
+ min_length=1, max_length=2)
field.validate(None)
field.validate((1, ))
field.validate((1, 2))
@@ -77,7 +78,8 @@
def testValidateValueTypes(self):
field = Tuple(title=u'Tuple field', description=u'',
- readonly=0, required=0, value_types=(Int(), Float()))
+ readonly=False, required=False,
+ value_types=(Int(), Float()))
field.validate(None)
field.validate((5.3,))
field.validate((2, 2.3))