diff --git a/VERSION b/VERSION index 3a17781..29a1ade 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0-rc3 +1.0.0-rc4 diff --git a/kim/pipelines/numeric.py b/kim/pipelines/numeric.py index e711ca2..e612eed 100644 --- a/kim/pipelines/numeric.py +++ b/kim/pipelines/numeric.py @@ -21,11 +21,12 @@ def is_valid_integer(session): """ try: - return int(session.data) + session.data = int(session.data) except TypeError: raise session.field.invalid(error_type='type_error') except ValueError: raise session.field.invalid(error_type='type_error') + return session.data @pipe() diff --git a/setup.py b/setup.py index d410a6f..93b1430 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) - self.test_args = ['-x', '-s'] + self.test_args = ['-s'] self.test_suite = True def run_tests(self): diff --git a/tests/test_pipelines/test_numeric.py b/tests/test_pipelines/test_numeric.py index fdb4a4c..42a60c3 100644 --- a/tests/test_pipelines/test_numeric.py +++ b/tests/test_pipelines/test_numeric.py @@ -46,6 +46,12 @@ def test_integer_input(): field.marshal(mapper_session) assert output == {'name': 2} + output = {} + mapper_session = get_mapper_session( + data={'name': '2', 'email': 'mike@mike.com'}, output=output) + field.marshal(mapper_session) + assert output == {'name': 2} + def test_integer_field_invalid_type(): @@ -122,6 +128,10 @@ def test_min_max(): field.marshal(mapper_session) assert output == {'age': 25} + mapper_session = get_mapper_session(data={'age': '25'}, output=output) + field.marshal(mapper_session) + assert output == {'age': 25} + def test_is_valid_decimal_pipe(): """test piping data through is_valid_decimal.