Permalink
Browse files

Fixed strings, added failing test, fixed readme

  • Loading branch information...
1 parent e41ca40 commit bda6556bd7a59d6b1e1d748fe31b1b5418717843 @Deepwalker committed Apr 11, 2012
Showing with 11 additions and 6 deletions.
  1. +7 −2 README.rst
  2. +4 −4 trafaret/__init__.py
View
@@ -12,9 +12,14 @@ Sample usage::
``t.Dict`` creates new dict structure validator with three ``t.Int`` elements.
``>>`` operation adds lambda function to the converters of given checker.
-Obviously every checker has some default converter, but when you use ``>>`` or ``.append``,
+Some checkers have default converter, but when you use ``>>`` or ``.append``,
you disable default converter with your own.
-Converters can be chained. You can raise DataError in converters.
+
+This does not mean that ``Int`` will not
+convert numbers to int, this mean that some checkers, like ``String`` with regular expression,
+have special converters applied to that can be overriden by your own.
+
+Converters can be chained. You can raise ``DataError`` in converters.
Features
--------
View
@@ -396,7 +396,7 @@ def _check_val(self, val):
try:
value = self.value_type(val)
except ValueError:
- self._failure("value cant be converted to %s" %
+ self._failure("value can't be converted to %s" %
self.value_type.__name__)
else:
self._failure("value is not %s" % self.value_type.__name__)
@@ -438,7 +438,7 @@ class Int(Float):
>>> Int().check(5)
5
>>> extract_error(Int(), 1.1)
- 1
+ "value can't be converted to int"
>>> extract_error(Int(), 1 + 1j)
'value is not int'
"""
@@ -653,7 +653,7 @@ class List(Trafaret):
>>> extract_error(List(Int, max_length=2), [1, 2, 3])
'list length is greater than 2'
>>> extract_error(List(Int), ["a"])
- {0: 'value cant be converted to int'}
+ {0: "value can't be converted to int"}
"""
__metaclass__ = SquareBracketsMeta
@@ -848,7 +848,7 @@ class Mapping(Trafaret):
>>> extract_error(trafaret, {"foo": 1, "bar": None})
{'bar': {'value': 'value is not int'}}
>>> extract_error(trafaret, {"foo": 1, 2: "bar"})
- {2: {'key': 'value is not string', 'value': 'value cant be converted to int'}}
+ {2: {'key': 'value is not string', 'value': "value can't be converted to int"}}
"""
def __init__(self, key, value):

0 comments on commit bda6556

Please sign in to comment.