summaryrefslogtreecommitdiff
path: root/docs/fields.rst
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2018-08-24 12:06:18 -0500
committerJason Madden <jamadden@gmail.com>2018-08-24 12:06:18 -0500
commitbab4c3104b82d4f4172180390bde5aec10a53e4e (patch)
tree0a7406788fdc45f80fc63a4dd1044c172f92104f /docs/fields.rst
parent845376502821b0ad4a08f5a3691b06cd49f1c9a3 (diff)
downloadzope-schema-issue16.tar.gz
Raise proper validation errors from Int and Float as well as Decimal.issue16
Fix the doctests that pointed out this should be done.
Diffstat (limited to 'docs/fields.rst')
-rw-r--r--docs/fields.rst24
1 files changed, 22 insertions, 2 deletions
diff --git a/docs/fields.rst b/docs/fields.rst
index 7799441..7ebabaf 100644
--- a/docs/fields.rst
+++ b/docs/fields.rst
@@ -101,7 +101,27 @@ Conversion from Unicode:
>>> f.fromUnicode("1.25.6") #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
- ValueError: invalid literal for float(): 1.25.6
+ InvalidFloatLiteral: invalid literal for float(): 1.25.6
+
+Int
+###
+
+:class:`zope.schema.Int` fields contain binary data, represented
+as a a Python ``int``.
+
+Conversion from Unicode:
+
+.. doctest::
+
+ >>> from zope.schema import Int
+ >>> f = Int()
+ >>> f.fromUnicode("1")
+ 1
+ >>> f.fromUnicode("1.25.6") #doctest: +IGNORE_EXCEPTION_DETAIL
+ Traceback (most recent call last):
+ ...
+ InvalidIntLiteral: invalid literal for int() with base 10: 1.25.6
+
Decimal
#######
@@ -123,7 +143,7 @@ Conversion from Unicode:
>>> f.fromUnicode("1.25.6")
Traceback (most recent call last):
...
- ValueError: invalid literal for Decimal(): 1.25.6
+ InvalidDecimalLiteral: invalid literal for Decimal(): 1.25.6
Datetime
########