[Zope3-checkins] CVS: Zope3/src/zope/schema/tests - test_boolfield.py:1.1.2.3 test_datetime.py:1.1.2.3 test_dictfield.py:1.1.2.3 test_equality.py:1.1.2.2 test_field.py:1.1.2.3 test_fieldproperty.py:1.1.2.2 test_floatfield.py:1.1.2.3 test_intfield.py:1.1.2.3 test_listfield.py:1.1.2.3 test_schema.py:1.1.2.3 test_strfield.py:1.1.2.3 test_tuplefield.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:48 -0500
Update of /cvs-repository/Zope3/src/zope/schema/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/schema/tests
Modified Files:
Tag: NameGeddon-branch
test_boolfield.py test_datetime.py test_dictfield.py
test_equality.py test_field.py test_fieldproperty.py
test_floatfield.py test_intfield.py test_listfield.py
test_schema.py test_strfield.py test_tuplefield.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/schema/tests/test_boolfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_boolfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_boolfield.py Tue Dec 24 21:21:16 2002
@@ -26,7 +26,7 @@
def testValidate(self):
field = Bool(title=u'Bool field', description=u'',
- readonly=False, required=False)
+ readonly=False, required=False)
field.validate(None)
field.validate(True)
field.validate(False)
=== Zope3/src/zope/schema/tests/test_datetime.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_datetime.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_datetime.py Tue Dec 24 21:21:16 2002
@@ -30,27 +30,27 @@
readonly=False, required=False)
field.validate(None)
field.validate(datetime.now())
-
+
def testValidateRequired(self):
field = Datetime(title=u'Datetime field', description=u'',
readonly=False, required=True)
field.validate(datetime.now())
-
+
self.assertRaisesErrorNames(errornames.RequiredMissing,
field.validate, None)
def testAllowedValues(self):
d1 = datetime(2000,10,1)
d2 = datetime(2000,10,2)
-
-
+
+
field = Datetime(title=u'Datetime field', description=u'',
readonly=False, required=False,
allowed_values=(d1, d2))
field.validate(None)
field.validate(d2)
field.validate(datetime(2000,10,2))
-
+
self.assertRaisesErrorNames(errornames.InvalidValue,
field.validate,
datetime(2000,10,4))
@@ -64,7 +64,7 @@
field.validate(d1)
field.validate(d2)
field.validate(datetime.now())
-
+
self.assertRaisesErrorNames(errornames.TooSmall, field.validate,
datetime(2000,9,30))
@@ -77,7 +77,7 @@
field.validate(None)
field.validate(d1)
field.validate(d2)
-
+
self.assertRaisesErrorNames(errornames.TooBig, field.validate, d3)
def testValidateMinAndMax(self):
=== Zope3/src/zope/schema/tests/test_dictfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_dictfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_dictfield.py Tue Dec 24 21:21:16 2002
@@ -31,25 +31,25 @@
field.validate({})
field.validate({1: 'foo'})
field.validate({'a': 1})
-
+
def testValidateRequired(self):
field = Dict(title=u'Dict field',
description=u'', readonly=False, required=True)
field.validate({})
field.validate({1: 'foo'})
field.validate({'a': 1})
-
+
self.assertRaisesErrorNames(errornames.RequiredMissing,
field.validate, None)
def testValidateMinValues(self):
field = Dict(title=u'Dict field',
description=u'', readonly=False, required=False,
- min_length=1)
+ min_length=1)
field.validate(None)
field.validate({1: 'a'})
field.validate({1: 'a', 2: 'b'})
-
+
self.assertRaisesErrorNames(errornames.TooShort,
field.validate, {})
@@ -60,7 +60,7 @@
field.validate(None)
field.validate({})
field.validate({1: 'a'})
-
+
self.assertRaisesErrorNames(errornames.TooLong,
field.validate, {1: 'a', 2: 'b'})
self.assertRaisesErrorNames(errornames.TooLong,
@@ -73,7 +73,7 @@
field.validate(None)
field.validate({1: 'a'})
field.validate({1: 'a', 2: 'b'})
-
+
self.assertRaisesErrorNames(errornames.TooShort,
field.validate, {})
self.assertRaisesErrorNames(errornames.TooLong,
@@ -86,7 +86,7 @@
field.validate(None)
field.validate({'a': 5.3})
field.validate({'a': 2, 'b': 2.3})
-
+
self.assertRaisesErrorNames(errornames.WrongContainedType,
field.validate, {1: ''} )
self.assertRaisesErrorNames(errornames.WrongContainedType,
=== Zope3/src/zope/schema/tests/test_equality.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/schema/tests/test_equality.py:1.1.2.1 Mon Dec 23 14:33:14 2002
+++ Zope3/src/zope/schema/tests/test_equality.py Tue Dec 24 21:21:16 2002
@@ -23,7 +23,7 @@
'Text(title=u"Foo", description=u"Bar")',
'Int(title=u"Foo", description=u"Bar")',
]
-
+
def test_equality(self):
for text in self.equality:
self.assertEquals(eval(text), eval(text))
=== Zope3/src/zope/schema/tests/test_field.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_field.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_field.py Tue Dec 24 21:21:16 2002
@@ -56,7 +56,7 @@
field.validate(1)
field.validate(0)
field.validate('')
-
+
def testValidateRequired(self):
field = self._Field_Factory(
title=u'Required field', description=u'',
@@ -65,19 +65,19 @@
field.validate(1)
field.validate(0)
field.validate('')
-
+
self.assertRaisesErrorNames(errornames.RequiredMissing,
field.validate, None)
class FieldTest(FieldTestBase):
"""Test generic Field."""
-
+
_Field_Factory = Field
def testSillyDefault(self):
-
+
self.assertRaises(ValidationError, Text, default="")
def test__doc__(self):
@@ -120,8 +120,8 @@
i.validate(11)
self.assertRaisesErrorNames(errornames.ConstraintNotSatisfied,
i.validate, 10)
-
-
+
+
class FieldDefaultBehaviour(TestCase):
def test_required_defaults_to_true(self):
class MyField(Field):
=== Zope3/src/zope/schema/tests/test_fieldproperty.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/schema/tests/test_fieldproperty.py:1.1.2.1 Mon Dec 23 14:33:14 2002
+++ Zope3/src/zope/schema/tests/test_fieldproperty.py Tue Dec 24 21:21:16 2002
@@ -56,8 +56,8 @@
self.assertEqual(c.title, u'c is good')
self.assertEqual(c.weight, 10)
self.assertEqual(c.code, 'abcdef')
-
-
+
+
def test_suite():
return TestSuite((
=== Zope3/src/zope/schema/tests/test_floatfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_floatfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_floatfield.py Tue Dec 24 21:21:16 2002
@@ -31,7 +31,7 @@
field.validate(10.0)
field.validate(0.93)
field.validate(1000.0003)
-
+
def testValidateRequired(self):
field = Float(title=u'Float field', description=u'',
readonly=False, required=True)
@@ -40,7 +40,7 @@
field.validate(1000.0003)
self.assertRaisesErrorNames(errornames.RequiredMissing,
- field.validate, None)
+ field.validate, None)
def testAllowedValues(self):
field = Float(title=u'Integer field', description=u'',
readonly=False, required=False,
=== Zope3/src/zope/schema/tests/test_intfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_intfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_intfield.py Tue Dec 24 21:21:16 2002
@@ -23,7 +23,7 @@
"""Test the Int Field."""
_Field_Factory = Int
-
+
def testValidate(self):
field = Int(title=u'Int field', description=u'',
readonly=False, required=False)
@@ -31,14 +31,14 @@
field.validate(10)
field.validate(0)
field.validate(-1)
-
+
def testValidateRequired(self):
field = Int(title=u'Int field', description=u'',
readonly=False, required=True)
field.validate(10)
field.validate(0)
field.validate(-1)
-
+
self.assertRaisesErrorNames(errornames.RequiredMissing,
field.validate, None)
@@ -47,7 +47,7 @@
readonly=False, required=False, allowed_values=(-1, 2))
field.validate(None)
field.validate(2)
-
+
self.assertRaisesErrorNames(errornames.InvalidValue,
field.validate, 4)
@@ -57,7 +57,7 @@
field.validate(None)
field.validate(10)
field.validate(20)
-
+
self.assertRaisesErrorNames(errornames.TooSmall, field.validate, 9)
self.assertRaisesErrorNames(errornames.TooSmall, field.validate, -10)
@@ -67,7 +67,7 @@
field.validate(None)
field.validate(5)
field.validate(9)
-
+
self.assertRaisesErrorNames(errornames.TooBig, field.validate, 11)
self.assertRaisesErrorNames(errornames.TooBig, field.validate, 20)
=== Zope3/src/zope/schema/tests/test_listfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_listfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_listfield.py Tue Dec 24 21:21:16 2002
@@ -31,14 +31,14 @@
field.validate([])
field.validate([1, 2])
field.validate([3,])
-
+
def testValidateRequired(self):
field = List(title=u'List field', description=u'',
readonly=False, required=True)
field.validate([])
field.validate([1, 2])
field.validate([3,])
-
+
self.assertRaisesErrorNames(errornames.RequiredMissing,
field.validate, None)
@@ -48,7 +48,7 @@
field.validate(None)
field.validate([1, 2])
field.validate([1, 2, 3])
-
+
self.assertRaisesErrorNames(errornames.TooShort,
field.validate, [])
self.assertRaisesErrorNames(errornames.TooShort,
@@ -60,7 +60,7 @@
field.validate(None)
field.validate([])
field.validate([1, 2])
-
+
self.assertRaisesErrorNames(errornames.TooLong,
field.validate, [1, 2, 3, 4])
self.assertRaisesErrorNames(errornames.TooLong,
=== Zope3/src/zope/schema/tests/test_schema.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_schema.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_schema.py Tue Dec 24 21:21:16 2002
@@ -29,7 +29,7 @@
description=u"Title",
default="",
required=True)
-
+
description = Bytes(
title=u"Description",
description=u"Description",
@@ -90,14 +90,14 @@
# test whether getName() has the right value
for key, value in fields.iteritems():
self.assertEquals(key, value.getName())
-
+
def test_getFieldsInOrder(self):
fields = getFieldsInOrder(ISchemaTest)
field_names = [name for name, field in fields]
self.assertEquals(field_names, ['title', 'description', 'spam'])
for key, value in fields:
self.assertEquals(key, value.getName())
-
+
def test_suite():
return makeSuite(SchemaTest)
=== Zope3/src/zope/schema/tests/test_strfield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_strfield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_strfield.py Tue Dec 24 21:21:16 2002
@@ -17,7 +17,7 @@
from unittest import TestSuite, main, makeSuite
from zope.schema import Bytes, BytesLine, Text, TextLine
from zope.schema import errornames
-from zope.schema.interfaces import ValidationError
+from zope.schema.interfaces import ValidationError
from zope.schema.tests.test_field import FieldTestBase
class StrTest(FieldTestBase):
@@ -29,12 +29,12 @@
field.validate(None)
field.validate(self._convert('foo'))
field.validate(self._convert(''))
-
+
def testValidateRequired(self):
# Note that if we want to require non-empty strings,
# we need to set the min-length to 1.
-
+
field = self._Field_Factory(
title=u'Str field', description=u'',
readonly=False, required=True, min_length=1)
@@ -96,7 +96,7 @@
field.validate(self._convert('333'))
field.validate(self._convert('4444'))
field.validate(self._convert('55555'))
-
+
self.assertRaisesErrorNames(errornames.TooShort,
field.validate, self._convert('22'))
self.assertRaisesErrorNames(errornames.TooShort,
@@ -112,7 +112,7 @@
def test_newlines(self):
field = self._Field_Factory(title=u'Str field')
field.validate(self._convert('hello\nworld'))
-
+
class BytesTest(StrTest, MultiLine):
_Field_Factory = Bytes
@@ -121,7 +121,7 @@
def testBadStringType(self):
field = self._Field_Factory()
self.assertRaises(ValidationError, field.validate, u'hello')
-
+
class TextTest(StrTest, MultiLine):
_Field_Factory = Text
@@ -138,7 +138,7 @@
field = self._Field_Factory(title=u'Str field')
self.assertRaisesErrorNames(errornames.ConstraintNotSatisfied,
field.validate,
- self._convert('hello\nworld'))
+ self._convert('hello\nworld'))
class LineTest(SingleLine, BytesTest):
_Field_Factory = BytesLine
=== Zope3/src/zope/schema/tests/test_tuplefield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/schema/tests/test_tuplefield.py:1.1.2.2 Mon Dec 23 15:37:34 2002
+++ Zope3/src/zope/schema/tests/test_tuplefield.py Tue Dec 24 21:21:16 2002
@@ -31,7 +31,7 @@
field.validate(())
field.validate((1, 2))
field.validate((3,))
-
+
def testValidateRequired(self):
field = Tuple(title=u'Tuple field', description=u'',
readonly=False, required=True)