summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2016-09-14 15:26:56 -0500
committerJason Madden <jamadden@gmail.com>2016-09-14 15:26:56 -0500
commiteef9e9246945a5cb69d9dfd5cb9784f0d3ab910d (patch)
treea211ea99dcecd367cc829a1072c3bde1f896794a
parent0fe956d7f3842ba4b2484da03d7b8872266ffe66 (diff)
downloadzope-schema-fix-doctests.tar.gz
Fix the remaining doctest snippets.fix-doctests
Remove the use of the _compat.b and _compat.u functions from the doctest snippets since we don't support 3.2 or 2.6 anymore (but u is still used in the code itself).
-rw-r--r--src/zope/schema/_bootstrapfields.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/zope/schema/_bootstrapfields.py b/src/zope/schema/_bootstrapfields.py
index ebc4270..5de0e21 100644
--- a/src/zope/schema/_bootstrapfields.py
+++ b/src/zope/schema/_bootstrapfields.py
@@ -126,16 +126,16 @@ class Field(Attribute):
Here are some examples:
- >>> from zope.schema._compat import u
+ >>> from zope.schema._bootstrapfields import Field
>>> f = Field()
>>> f.__doc__, f.title, f.description
('', u'', u'')
- >>> f = Field(title=u('sample'))
+ >>> f = Field(title=u'sample')
>>> f.__doc__, f.title, f.description
(u'sample', u'sample', u'')
- >>> f = Field(title=u('sample'), description=u('blah blah\\nblah'))
+ >>> f = Field(title=u'sample', description=u'blah blah\\nblah')
>>> f.__doc__, f.title, f.description
(u'sample\\n\\nblah blah\\nblah', u'sample', u'blah blah\\nblah')
"""
@@ -326,16 +326,15 @@ class Text(MinMaxLen, Field):
def fromUnicode(self, str):
"""
- >>> from zope.schema._compat import u
- >>> from zope.schema._compat import b
+ >>> from zope.schema import Text
>>> t = Text(constraint=lambda v: 'x' in v)
- >>> t.fromUnicode(b("foo x spam"))
+ >>> t.fromUnicode(b"foo x spam")
Traceback (most recent call last):
...
WrongType: ('foo x spam', <type 'unicode'>, '')
- >>> t.fromUnicode(u("foo x spam"))
+ >>> t.fromUnicode(u"foo x spam")
u'foo x spam'
- >>> t.fromUnicode(u("foo spam"))
+ >>> t.fromUnicode(u"foo spam")
Traceback (most recent call last):
...
ConstraintNotSatisfied: (u'foo spam', '')
@@ -400,7 +399,8 @@ class Bool(Field):
def fromUnicode(self, str):
"""
- >>> from zope.schema._compat import b
+ >>> from zope.schema._bootstrapfields import Bool
+ >>> from zope.schema.interfaces import IFromUnicode
>>> b = Bool()
>>> IFromUnicode.providedBy(b)
True
@@ -428,6 +428,7 @@ class Int(Orderable, Field):
def fromUnicode(self, str):
"""
+ >>> from zope.schema._bootstrapfields import Int
>>> f = Int()
>>> f.fromUnicode("125")
125