Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.1: pytest is failing #173

Open
kloczek opened this issue Dec 5, 2021 · 7 comments
Open

2.0.1: pytest is failing #173

kloczek opened this issue Dec 5, 2021 · 7 comments

Comments

@kloczek
Copy link

kloczek commented Dec 5, 2021

I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1, configfile: pytest.ini
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, cov-2.12.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0, tornasync-0.6.0.post2, console-scripts-1.2.0, trio-0.7.0, timeout-2.0.1, asyncio-0.16.0, freezegun-0.4.2, flake8-1.0.7, pyfakefs-4.5.3, hypothesis-6.29.3, benchmark-3.4.1, profiling-1.7.0, datadir-1.3.1, regressions-2.2.0, randomly-3.8.0, rerunfailures-9.1.1, yagot-0.5.0, requests-mock-1.9.3, django-4.5.1
collected 268 items

formencode/tests/test_cc.py ..                                                                                                                                       [  0%]
formencode/tests/test_compound.py .................                                                                                                                  [  7%]
formencode/tests/test_context.py ...                                                                                                                                 [  8%]
formencode/tests/test_declarative.py ....                                                                                                                            [  9%]
formencode/tests/test_doctest_xml_compare.py .                                                                                                                       [ 10%]
formencode/tests/test_doctests.py ......F..                                                                                                                          [ 13%]
formencode/tests/test_email.py ....                                                                                                                                  [ 14%]
formencode/tests/test_htmlfill.py ..............................................                                                                                     [ 32%]
formencode/tests/test_htmlfill_control.py .......                                                                                                                    [ 34%]
formencode/tests/test_htmlgen.py .......                                                                                                                             [ 37%]
formencode/tests/test_htmlrename.py .                                                                                                                                [ 37%]
formencode/tests/test_i18n.py ........................                                                                                                               [ 46%]
formencode/tests/test_schema.py .......................                                                                                                              [ 55%]
formencode/tests/test_subclassing.py ...............                                                                                                                 [ 60%]
formencode/tests/test_subclassing_old.py ................                                                                                                            [ 66%]
formencode/tests/test_validators.py ..............................................................................                                                   [ 95%]
formencode/tests/test_variabledecode.py ...........                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
__________________________________________________________ test_doctests[_wrapper-formencode.national-False-True] __________________________________________________________

testfn = <function set_func_description.<locals>._wrapper at 0x7f1592e03790>
document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    @pytest.mark.parametrize("testfn,document,verbose,raise_error", list(collect_functions()))
    def test_doctests(testfn,document,verbose,raise_error):
        """Generate each doctest."""
>       testfn(document, verbose, raise_error)

formencode/tests/test_doctests.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
formencode/tests/test_doctests.py:73: in _wrapper
    fn(*a_test_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    def doctest_module(document, verbose, raise_error):
        failure_count, test_count = doctest.testmod(document,
                optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL,
                verbose=verbose)
        if raise_error:
            assert test_count > 0
>           assert failure_count == 0
E           assert 11 == 0

formencode/tests/test_doctests.py:67: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 423, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Germany')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[0]>", line 1, in <module>
        CountryValidator.to_python('Germany')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 425, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Finland')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[1]>", line 1, in <module>
        CountryValidator.to_python('Finland')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 427, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('UNITED STATES')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[2]>", line 1, in <module>
        CountryValidator.to_python('UNITED STATES')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 429, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Krakovia')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That country is not listed in ISO 3166
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[3]>", line 1, in <module>
        CountryValidator.to_python('Krakovia')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 433, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('DE')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[4]>", line 1, in <module>
        CountryValidator.from_python('DE')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 435, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('FI')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[5]>", line 1, in <module>
        CountryValidator.from_python('FI')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 825, in formencode.national.LanguageValidator
Failed example:
    l.to_python('German')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[1]>", line 1, in <module>
        l.to_python('German')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 827, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Chinese')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[2]>", line 1, in <module>
        l.to_python('Chinese')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 829, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Klingonian')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That language is not listed in ISO 639
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[3]>", line 1, in <module>
        l.to_python('Klingonian')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 833, in formencode.national.LanguageValidator
Failed example:
    l.from_python('de')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[4]>", line 1, in <module>
        l.from_python('de')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 835, in formencode.national.LanguageValidator
Failed example:
    l.from_python('zh')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[5]>", line 1, in <module>
        l.from_python('zh')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
2 items had failures:
   6 of   6 in formencode.national.CountryValidator
   5 of   6 in formencode.national.LanguageValidator
***Test Failed*** 11 failures.
============================================================================= warnings summary =============================================================================
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/declarative.py:167: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.
    setattr(cls, name, cls(

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  <doctest formencode.national.LanguageValidator[0]>:1: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True] - assert 11 == 0
================================================================ 1 failed, 267 passed, 8 warnings in 2.56s =================================================================
@kloczek
Copy link
Author

kloczek commented Dec 5, 2021

Looks like I've hit jackpot because after deselering that failing unit another units failures popped out.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --deselect 'formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]'
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=2631797068
rootdir: /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1, configfile: pytest.ini
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, cov-2.12.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0, tornasync-0.6.0.post2, console-scripts-1.2.0, trio-0.7.0, timeout-2.0.1, asyncio-0.16.0, freezegun-0.4.2, flake8-1.0.7, pyfakefs-4.5.3, hypothesis-6.29.3, benchmark-3.4.1, profiling-1.7.0, datadir-1.3.1, regressions-2.2.0, randomly-3.8.0, rerunfailures-9.1.1, yagot-0.5.0, requests-mock-1.9.3, django-4.5.1
collected 268 items / 1 deselected / 267 selected

formencode/tests/test_email.py ....                                                                                                                                  [  1%]
formencode/tests/test_schema.py .......................                                                                                                              [ 10%]
formencode/tests/test_doctest_xml_compare.py .                                                                                                                       [ 10%]
formencode/tests/test_variabledecode.py ...........                                                                                                                  [ 14%]
formencode/tests/test_compound.py .................                                                                                                                  [ 20%]
formencode/tests/test_htmlgen.py .......                                                                                                                             [ 23%]
formencode/tests/test_i18n.py ........F...............                                                                                                               [ 32%]
formencode/tests/test_cc.py ..                                                                                                                                       [ 33%]
formencode/tests/test_validators.py F............FFF......F.........F......F.F.F.F.F..FF.F.F......................                                                   [ 62%]
formencode/tests/test_declarative.py ....                                                                                                                            [ 64%]
formencode/tests/test_htmlfill.py ..............................................                                                                                     [ 81%]
formencode/tests/test_subclassing.py .FFF.FFF...F...                                                                                                                 [ 86%]
formencode/tests/test_context.py ...                                                                                                                                 [ 88%]
formencode/tests/test_htmlfill_control.py .......                                                                                                                    [ 90%]
formencode/tests/test_htmlrename.py .                                                                                                                                [ 91%]
formencode/tests/test_subclassing_old.py ..FFF....F.FF.F.                                                                                                            [ 97%]
formencode/tests/test_doctests.py ........                                                                                                                           [100%]

================================================================================= FAILURES =================================================================================
______________________________________________________________________________ test_builtins _______________________________________________________________________________

func = <function test_builtins.<locals>.withbuiltins at 0x7f4ae3d57ee0>

    def _test_builtins(func):
        def dummy(s):
            return "builtins dummy"
        import six.moves.builtins
        six.moves.builtins._ = dummy

        try:
>           ne.to_python("")

formencode/tests/test_i18n.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotEmpty object 66 use_builtins_gettext=False>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
>                   raise Invalid(self.message('empty', state), value, state)
E                   formencode.api.Invalid: Please enter a value

formencode/api.py:497: Invalid

During handling of the above exception, another exception occurred:

    def test_builtins():
        def withbuiltins(e):
            assert str(e) == "builtins dummy"

>       _test_builtins(withbuiltins)

formencode/tests/test_i18n.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
formencode/tests/test_i18n.py:20: in _test_builtins
    func(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

e = Invalid('Please enter a value', '', None, None, None)

    def withbuiltins(e):
>       assert str(e) == "builtins dummy"
E       AssertionError: assert 'Please enter a value' == 'builtins dummy'
E         - builtins dummy
E         + Please enter a value

formencode/tests/test_i18n.py:27: AssertionError
_______________________________________________________________ TestForEachValidator.test_foreach_if_missing _______________________________________________________________

self = <formencode.tests.test_validators.TestForEachValidator testMethod=test_foreach_if_missing>

    def test_foreach_if_missing(self):

        class SubSchema(Schema):
            age = validators.Int()
            name = validators.String(not_empty=True)

        class MySchema(Schema):
            pre_validators = [NestedVariables()]
            people = ForEach(SubSchema(), if_missing=NoDefault,
                messages={'missing': 'Please add a person'})

        validator = MySchema()

        self.assertFalse(validator.fields['people'].not_empty)

        class State:
            pass

        start_values = {}
        state = State()

        try:
>           values = validator.to_python(start_values, state)

formencode/tests/test_validators.py:443:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MySchema object 312 chained_validators=[] fields={'people': <ForEach object 310 validators=[<SubSchema object 309 cha...ng='utf-8' not_empty=True outputEncoding='utf-8'>} pre_validators=[]>]>} pre_validators=[<NestedVariables object 308>]>
value = <class 'formencode.api.NoDefault'>, state = <formencode.tests.test_validators.TestForEachValidator.test_foreach_if_missing.<locals>.State object at 0x7f4ae39e9850>

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MySchema object 312 chained_validators=[] fields={'people': <ForEach object 310 validators=[<SubSchema object 309 cha...ng='utf-8' not_empty=True outputEncoding='utf-8'>} pre_validators=[]>]>} pre_validators=[<NestedVariables object 308>]>
value_dict = {}, state = <formencode.tests.test_validators.TestForEachValidator.test_foreach_if_missing.<locals>.State object at 0x7f4ae39e9850>

    def _convert_to_python(self, value_dict, state):
        if not value_dict:
            if self.if_empty is not NoDefault:
                return self.if_empty
            value_dict = {}

        for validator in self.pre_validators:
            value_dict = validator.to_python(value_dict, state)

        self.assert_dict(value_dict, state)

        new = {}
        errors = {}
        unused = list(self.fields.keys())
        if state is not None:
            previous_key = getattr(state, 'key', None)
            previous_full_dict = getattr(state, 'full_dict', None)
            state.full_dict = value_dict
        try:
            for name, value in list(value_dict.items()):
                try:
                    unused.remove(name)
                except ValueError:
                    if not self.allow_extra_fields:
                        raise Invalid(self.message('notExpected',
                            state, name=repr(name)), value_dict, state)
                    if not self.filter_extra_fields:
                        new[name] = value
                    continue
                validator = self.fields[name]

                # are iterators (list, tuple, set, etc) allowed?
                if self._value_is_iterator(value) and not getattr(
                        validator, 'accept_iterator', False):
                    errors[name] = Invalid(self.message(
                        'singleValueExpected', state), value_dict, state)

                if state is not None:
                    state.key = name
                try:
                    new[name] = validator.to_python(value, state)
                except Invalid as e:
                    errors[name] = e

            for name in unused:
                validator = self.fields[name]
                try:
                    if_missing = validator.if_missing
                except AttributeError:
                    if_missing = NoDefault
                if if_missing is NoDefault:
                    if self.ignore_key_missing:
                        continue
                    if self.if_key_missing is NoDefault:
                        try:
                            message = validator.message('missing', state)
                        except KeyError:
                            message = self.message('missingValue', state)
                        errors[name] = Invalid(message, None, state)
                    else:
                        if state is not None:
                            state.key = name
                        try:
                            new[name] = validator.to_python(
                                self.if_key_missing, state)
                        except Invalid as e:
                            errors[name] = e
                else:
                    new[name] = validator.if_missing

            if state is not None:
                state.key = previous_key
            for validator in self.chained_validators:
                if (not hasattr(validator, 'validate_partial') or not getattr(
                        validator, 'validate_partial_form', False)):
                    continue
                try:
                    validator.validate_partial(value_dict, state)
                except Invalid as e:
                    sub_errors = e.unpack_errors()
                    if not isinstance(sub_errors, dict):
                        # Can't do anything here
                        continue
                    merge_dicts(errors, sub_errors)

            if errors:
>               raise Invalid(
                    format_compound_error(errors),
                    value_dict, state, error_dict=errors)
E                   formencode.api.Invalid: people: builtins dummy

formencode/schema.py:219: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestForEachValidator testMethod=test_foreach_if_missing>

    def test_foreach_if_missing(self):

        class SubSchema(Schema):
            age = validators.Int()
            name = validators.String(not_empty=True)

        class MySchema(Schema):
            pre_validators = [NestedVariables()]
            people = ForEach(SubSchema(), if_missing=NoDefault,
                messages={'missing': 'Please add a person'})

        validator = MySchema()

        self.assertFalse(validator.fields['people'].not_empty)

        class State:
            pass

        start_values = {}
        state = State()

        try:
            values = validator.to_python(start_values, state)
        except Invalid as e:
>           self.assertEqual(e.unpack_errors(),
                {'people': 'Please add a person'})
E           AssertionError: {'people': 'builtins dummy'} != {'people': 'Please add a person'}
E           - {'people': 'builtins dummy'}
E           + {'people': 'Please add a person'}

formencode/tests/test_validators.py:445: AssertionError
________________________________________________________________ TestRequireIfMissingValidator.test_present ________________________________________________________________

self = <formencode.tests.test_validators.TestRequireIfMissingValidator testMethod=test_present>

    def test_present(self):
        v = self.validator('phone_type', present='phone')
>       self.assertEqual(
            validate(v, dict(phone_type='', phone='510 420  4577')),
            dict(phone_type='Please enter a value'))
E       AssertionError: {'phone_type': 'builtins dummy'} != {'phone_type': 'Please enter a value'}
E       - {'phone_type': 'builtins dummy'}
E       + {'phone_type': 'Please enter a value'}

formencode/tests/test_validators.py:764: AssertionError
_________________________________________________________________ TestRequireIfMissingValidator.test_zero __________________________________________________________________

self = <formencode.tests.test_validators.TestRequireIfMissingValidator testMethod=test_zero>

    def test_zero(self):
        v = self.validator('operator', present='operand')
>       self.assertEqual(
            validate(v, dict(operator='', operand=0)),
            dict(operator='Please enter a value'))
E       AssertionError: {'operator': 'builtins dummy'} != {'operator': 'Please enter a value'}
E       - {'operator': 'builtins dummy'}
E       + {'operator': 'Please enter a value'}

formencode/tests/test_validators.py:772: AssertionError
________________________________________________________________ TestRequireIfMissingValidator.test_missing ________________________________________________________________

self = <formencode.tests.test_validators.TestRequireIfMissingValidator testMethod=test_missing>

    def test_missing(self):
        v = self.validator('phone_type', missing='mail')
>       self.assertEqual(
            validate(v, dict(phone_type='')),
            dict(phone_type='Please enter a value'))
E       AssertionError: {'phone_type': 'builtins dummy'} != {'phone_type': 'Please enter a value'}
E       - {'phone_type': 'builtins dummy'}
E       + {'phone_type': 'Please enter a value'}

formencode/tests/test_validators.py:755: AssertionError
____________________________________________________________________ TestOneOfValidator.test_mixed_list ____________________________________________________________________

self = <formencode.tests.test_validators.TestOneOfValidator testMethod=test_mixed_list>

    def test_mixed_list(self):
        """before `_message_vars_decode`, the errors were:
            Value must be one of: a; b; ö; ™; 1; 2; 3 (not u'c')
            Value must be one of: a; b; ö; ™; 1; 2; 3 (not u'\xa7')
        """
        o = validators.OneOf(['a', 'b', 'ö', '™', 1, 2, 3])
        try:
>           o.to_python('c')

formencode/tests/test_validators.py:652:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OneOf object 338 list=['a', 'b', 'ö', '™', 1, 2, 3]>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
                value = tp(value, state)
            vp = self._validate_python
            if vp and vp is not self._validate_noop:
>               vp(value, state)

formencode/api.py:509:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OneOf object 338 list=['a', 'b', 'ö', '™', 1, 2, 3]>, value = 'c', state = None

    def _validate_python(self, value, state):
        if self.testValueList and isinstance(value, (list, tuple)):
            for v in value:
                self._validate_python(v, state)
        else:
            if value not in self.list:
                if self.hideList:
                    raise Invalid(self.message('invalid', state), value, state)
                else:
                    try:
                        items = '; '.join(map(str, self.list))
                    except UnicodeError:
                        items = '; '.join(map(six.text_type, self.list))
>                   raise Invalid(
                        self.message('notIn', state,
                            items=items, value=value), value, state)
E                   formencode.api.Invalid: builtins dummy

formencode/validators.py:623: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestOneOfValidator testMethod=test_mixed_list>

    def test_mixed_list(self):
        """before `_message_vars_decode`, the errors were:
            Value must be one of: a; b; ö; ™; 1; 2; 3 (not u'c')
            Value must be one of: a; b; ö; ™; 1; 2; 3 (not u'\xa7')
        """
        o = validators.OneOf(['a', 'b', 'ö', '™', 1, 2, 3])
        try:
            o.to_python('c')
            raise ValueError("exception expected")
        except Invalid as e:
>           self.assertTrue("Value must be one of: a; b; ö; ™; 1; 2; 3 (not 'c')" in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:655: AssertionError
___________________________________________________________________ TestTimeConverterValidator.test_time ___________________________________________________________________

self = <formencode.tests.test_validators.TestTimeConverterValidator testMethod=test_time>

    def test_time(self):
        tc = self.validator()
        self.assertEqual(tc.to_python('20:30:15'), (20, 30, 15))
        try:
>           tc.to_python('25:30:15')

formencode/tests/test_validators.py:389:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TimeConverter object 351>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TimeConverter object 351>, value = '25:30:15', state = None

    def _convert_to_python(self, value, state):
>       result = self._to_python_tuple(value, state)

formencode/validators.py:2224:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TimeConverter object 351>, value = '25:30:15', state = None

    def _to_python_tuple(self, value, state):
        time = value.strip()
        explicit_ampm = False
        if self.use_ampm:
            last_two = time[-2:].lower()
            if last_two not in ('am', 'pm'):
                if self.use_ampm != 'optional':
                    raise Invalid(self.message('noAMPM', state), value, state)
                offset = 0
            else:
                explicit_ampm = True
                offset = 12 if last_two == 'pm' else 0
                time = time[:-2]
        else:
            offset = 0
        parts = time.split(':', 3)
        if len(parts) > 3:
            raise Invalid(self.message('tooManyColon', state), value, state)
        if len(parts) == 3 and not self.use_seconds:
            raise Invalid(self.message('noSeconds', state), value, state)
        if (len(parts) == 2
                and self.use_seconds and self.use_seconds != 'optional'):
            raise Invalid(self.message('secondsRequired', state), value, state)
        if len(parts) == 1:
            raise Invalid(self.message('minutesRequired', state), value, state)
        try:
            hour = int(parts[0])
        except ValueError:
            raise Invalid(
                self.message('badNumber', state,
                    number=parts[0], part='hour'), value, state)
        if explicit_ampm:
            if not 1 <= hour <= 12:
                raise Invalid(
                    self.message('badHour', state,
                        number=hour, range='1-12'), value, state)
            if hour == 12 and offset == 12:
                # 12pm == 12
                pass
            elif hour == 12 and offset == 0:
                # 12am == 0
                hour = 0
            else:
                hour += offset
        else:
            if not 0 <= hour < 24:
>               raise Invalid(
                    self.message('badHour', state,
                        number=hour, range='0-23'), value, state)
E               formencode.api.Invalid: builtins dummy

formencode/validators.py:2278: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestTimeConverterValidator testMethod=test_time>

    def test_time(self):
        tc = self.validator()
        self.assertEqual(tc.to_python('20:30:15'), (20, 30, 15))
        try:
            tc.to_python('25:30:15')
        except Invalid as e:
>           self.assertTrue(
                'You must enter an hour in the range 0-23' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:391: AssertionError
_______________________________________________________________ TestRequireIfMatchingValidator.test_matching _______________________________________________________________

self = <formencode.tests.test_validators.TestRequireIfMatchingValidator testMethod=test_matching>

    def test_matching(self):
        v = self.validator('phone_type', 'mobile', required_fields=['mobile'])
>       self.assertEqual(
            validate(v, dict(phone_type='mobile')),
            dict(mobile='Please enter a value')
        )
E       AssertionError: {'mobile': 'builtins dummy'} != {'mobile': 'Please enter a value'}
E       - {'mobile': 'builtins dummy'}
E       + {'mobile': 'Please enter a value'}

formencode/tests/test_validators.py:791: AssertionError
______________________________________________________ TestRequireIfMatchingValidator.test_matching_multiple_required ______________________________________________________

self = <formencode.tests.test_validators.TestRequireIfMatchingValidator testMethod=test_matching_multiple_required>

    def test_matching_multiple_required(self):
        v = self.validator('phone_type', 'mobile', required_fields=['mobile', 'code'])
>       self.assertEqual(
            validate(v, dict(phone_type='mobile')),
            dict(mobile='Please enter a value')
        )
E       AssertionError: {'mobile': 'builtins dummy'} != {'mobile': 'Please enter a value'}
E       - {'mobile': 'builtins dummy'}
E       + {'mobile': 'Please enter a value'}

formencode/tests/test_validators.py:798: AssertionError
________________________________________________________________ TestIPAddressValidator.test_leading_zeros _________________________________________________________________

self = <formencode.tests.test_validators.TestIPAddressValidator testMethod=test_leading_zeros>

    def test_leading_zeros(self):
        validate = self.validator().to_python
        try:
>           validate('1.2.3.037')

formencode/tests/test_validators.py:696:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <IPAddress object 360>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
                value = tp(value, state)
            vp = self._validate_python
            if vp and vp is not self._validate_noop:
>               vp(value, state)

formencode/api.py:509:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <IPAddress object 360>, value = '1.2.3.037', state = None

    def _validate_python(self, value, state=None):
        try:
            if not value:
                raise ValueError
            octets = value.split('.', 5)
            # Only 4 octets?
            if len(octets) != 4:
                raise ValueError
            # Correct octets?
            for octet in octets:
                if octet.startswith('0') and octet != '0':
                    if not self.leading_zeros:
>                       raise Invalid(
                            self.message('leadingZeros', state), value, state)
E                           formencode.api.Invalid: builtins dummy

formencode/validators.py:2567: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestIPAddressValidator testMethod=test_leading_zeros>

    def test_leading_zeros(self):
        validate = self.validator().to_python
        try:
            validate('1.2.3.037')
        except Invalid as e:
>           self.assertTrue('The octets must not have leading zeros' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:698: AssertionError
____________________________________________________________ TestIPAddressValidator.test_leading_zeros_allowed _____________________________________________________________

self = <formencode.tests.test_validators.TestIPAddressValidator testMethod=test_leading_zeros_allowed>

    def test_leading_zeros_allowed(self):
        validate = self.validator(leading_zeros=True).to_python
        try:
            validate('1.2.3.037')
        except Invalid as e:
            self.fail('IP address octets with leading zeros should be valid')
        try:
>           validate('1.2.3.0377')

formencode/tests/test_validators.py:715:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <IPAddress object 362 leading_zeros=True>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
                value = tp(value, state)
            vp = self._validate_python
            if vp and vp is not self._validate_noop:
>               vp(value, state)

formencode/api.py:509:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <IPAddress object 362 leading_zeros=True>, value = '1.2.3.0377', state = None

    def _validate_python(self, value, state=None):
        try:
            if not value:
                raise ValueError
            octets = value.split('.', 5)
            # Only 4 octets?
            if len(octets) != 4:
                raise ValueError
            # Correct octets?
            for octet in octets:
                if octet.startswith('0') and octet != '0':
                    if not self.leading_zeros:
                        raise Invalid(
                            self.message('leadingZeros', state), value, state)
                    # strip zeros so this won't be an octal number
                    octet = octet.lstrip('0')
                if not 0 <= int(octet) < 256:
>                   raise Invalid(
                        self.message('illegalOctets', state, octet=octet),
                        value, state)
E                       formencode.api.Invalid: builtins dummy

formencode/validators.py:2572: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestIPAddressValidator testMethod=test_leading_zeros_allowed>

    def test_leading_zeros_allowed(self):
        validate = self.validator(leading_zeros=True).to_python
        try:
            validate('1.2.3.037')
        except Invalid as e:
            self.fail('IP address octets with leading zeros should be valid')
        try:
            validate('1.2.3.0377')
        except Invalid as e:
>           self.assertTrue("The octets must be within the range of 0-255"
                " (not '377')" in unicode(e).replace("u'", "'"))
E           AssertionError: False is not true

formencode/tests/test_validators.py:717: AssertionError
________________________________________________________________ TestDateConverterValidator.test_iso_style _________________________________________________________________

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_iso_style>

    def test_iso_style(self):
        d = datetime.date(2013, 6, 30)
        dc = self.validator(month_style='yyyy/mm/dd')
        self.assertEqual(dc.to_python('2013/06/30'), d)
        self.assertEqual(dc.from_python(d), '2013/06/30')
        self.assertEqual(dc.to_python('2013/Jun/30'), d)
        self.assertEqual(dc.to_python('2013/June/30'), d)
        try:
>           self.assertEqual(dc.to_python('2013/30/06'), d)

formencode/tests/test_validators.py:304:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 364 accept_day=True format='%Y/%m/%d' human_format='YYYY/MM/DD' month_style='ymd' separator='/'>, value = <class 'formencode.api.NoDefault'>
state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 364 accept_day=True format='%Y/%m/%d' human_format='YYYY/MM/DD' month_style='ymd' separator='/'>, value = '2013/30/06', state = None

    def _convert_to_python(self, value, state):
        self.assert_string(value, state)
        month_style = self.month_style
        if not self.accept_day:
            month_style = 'ym' if month_style == 'ymd' else 'my'
        match = self._date_re[month_style].search(value)
        if not match:
            raise Invalid(
                self.message('badFormat', state,
                    format=self.human_format), value, state)
        groups = match.groups()
        if self.accept_day:
            if month_style == 'mdy':
                month, day, year = groups
            elif month_style == 'dmy':
                day, month, year = groups
            else:
                year, month, day = groups
            day = int(day)
            if not 1 <= day <= 31:
                raise Invalid(self.message('invalidDay', state), value, state)
        else:
            day = 1
            if month_style == 'my':
                month, year = groups
            else:
                year, month = groups
        month = self.make_month(month, state)
        if not 1 <= month <= 12:
>           raise Invalid(self.message('monthRange', state), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/validators.py:2092: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_iso_style>

    def test_iso_style(self):
        d = datetime.date(2013, 6, 30)
        dc = self.validator(month_style='yyyy/mm/dd')
        self.assertEqual(dc.to_python('2013/06/30'), d)
        self.assertEqual(dc.from_python(d), '2013/06/30')
        self.assertEqual(dc.to_python('2013/Jun/30'), d)
        self.assertEqual(dc.to_python('2013/June/30'), d)
        try:
            self.assertEqual(dc.to_python('2013/30/06'), d)
        except Invalid as e:
>           self.assertTrue('Please enter a month from 1 to 12' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:306: AssertionError
________________________________________________________________ TestDateConverterValidator.test_bad_dates _________________________________________________________________

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_bad_dates>

    def test_bad_dates(self):
        dc = self.validator(month_style='dd/mm/yyyy')
        try:
>           dc.to_python('20/12/150')

formencode/tests/test_validators.py:213:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 374 accept_day=True format='%d/%m/%Y' human_format='DD/MM/YYYY' month_style='dmy' separator='/'>, value = <class 'formencode.api.NoDefault'>
state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 374 accept_day=True format='%d/%m/%Y' human_format='DD/MM/YYYY' month_style='dmy' separator='/'>, value = '20/12/150', state = None

    def _convert_to_python(self, value, state):
        self.assert_string(value, state)
        month_style = self.month_style
        if not self.accept_day:
            month_style = 'ym' if month_style == 'ymd' else 'my'
        match = self._date_re[month_style].search(value)
        if not match:
            raise Invalid(
                self.message('badFormat', state,
                    format=self.human_format), value, state)
        groups = match.groups()
        if self.accept_day:
            if month_style == 'mdy':
                month, day, year = groups
            elif month_style == 'dmy':
                day, month, year = groups
            else:
                year, month, day = groups
            day = int(day)
            if not 1 <= day <= 31:
                raise Invalid(self.message('invalidDay', state), value, state)
        else:
            day = 1
            if month_style == 'my':
                month, year = groups
            else:
                year, month = groups
        month = self.make_month(month, state)
        if not 1 <= month <= 12:
            raise Invalid(self.message('monthRange', state), value, state)
        if self._monthDays[month] < day:
            raise Invalid(
                self.message('dayRange', state,
                    days=self._monthDays[month]), value, state)
>       year = self.make_year(year, state)

formencode/validators.py:2097:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 374 accept_day=True format='%d/%m/%Y' human_format='DD/MM/YYYY' month_style='dmy' separator='/'>, year = 150, state = None

    def make_year(self, year, state):
        try:
            year = int(year)
        except ValueError:
            raise Invalid(self.message('invalidYear', state), year, state)
        if year <= 20:
            year += 2000
        elif 50 <= year < 100:
            year += 1900
        if 20 < year < 50 or 99 < year < 1900:
>           raise Invalid(self.message('fourDigitYear', state), year, state)
E           formencode.api.Invalid: builtins dummy

formencode/validators.py:2127: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_bad_dates>

    def test_bad_dates(self):
        dc = self.validator(month_style='dd/mm/yyyy')
        try:
            dc.to_python('20/12/150')
        except Invalid as e:
>           self.assertTrue(
                'Please enter a four-digit year after 1899' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:215: AssertionError
__________________________________________________________________ TestDateConverterValidator.test_no_day __________________________________________________________________

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_no_day>

    def test_no_day(self):
        d = datetime.date(2007, 12, 1)
        dc = self.validator(accept_day=False)
        self.assertEqual(dc.to_python('12/2007'), d)
        self.assertEqual(dc.from_python(d), '12/2007')
        self.assertEqual(dc.to_python('Dec/2007'), d)
        self.assertEqual(dc.to_python('December/2007'), d)
        try:
>           self.assertEqual(dc.to_python('20/2007'), d)

formencode/tests/test_validators.py:325:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 375 accept_day=False format='%m/%Y' human_format='MM/YYYY' month_style='mdy' separator='/'>, value = <class 'formencode.api.NoDefault'>
state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 375 accept_day=False format='%m/%Y' human_format='MM/YYYY' month_style='mdy' separator='/'>, value = '20/2007', state = None

    def _convert_to_python(self, value, state):
        self.assert_string(value, state)
        month_style = self.month_style
        if not self.accept_day:
            month_style = 'ym' if month_style == 'ymd' else 'my'
        match = self._date_re[month_style].search(value)
        if not match:
            raise Invalid(
                self.message('badFormat', state,
                    format=self.human_format), value, state)
        groups = match.groups()
        if self.accept_day:
            if month_style == 'mdy':
                month, day, year = groups
            elif month_style == 'dmy':
                day, month, year = groups
            else:
                year, month, day = groups
            day = int(day)
            if not 1 <= day <= 31:
                raise Invalid(self.message('invalidDay', state), value, state)
        else:
            day = 1
            if month_style == 'my':
                month, year = groups
            else:
                year, month = groups
        month = self.make_month(month, state)
        if not 1 <= month <= 12:
>           raise Invalid(self.message('monthRange', state), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/validators.py:2092: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_no_day>

    def test_no_day(self):
        d = datetime.date(2007, 12, 1)
        dc = self.validator(accept_day=False)
        self.assertEqual(dc.to_python('12/2007'), d)
        self.assertEqual(dc.from_python(d), '12/2007')
        self.assertEqual(dc.to_python('Dec/2007'), d)
        self.assertEqual(dc.to_python('December/2007'), d)
        try:
            self.assertEqual(dc.to_python('20/2007'), d)
        except Invalid as e:
>           self.assertTrue('Please enter a month from 1 to 12' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:327: AssertionError
________________________________________________________________ TestDateConverterValidator.test_euro_style ________________________________________________________________

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_euro_style>

    def test_euro_style(self):
        d = datetime.date(2007, 12, 20)
        dc = self.validator(month_style='dd/mm/yyyy')
        self.assertEqual(dc.to_python('20/12/2007'), d)
        self.assertEqual(dc.from_python(d), '20/12/2007')
        self.assertEqual(dc.to_python('20/Dec/2007'), d)
        self.assertEqual(dc.to_python('20/December/2007'), d)
        try:
>           self.assertEqual(dc.to_python('12/20/2007'), d)

formencode/tests/test_validators.py:283:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 379 accept_day=True format='%d/%m/%Y' human_format='DD/MM/YYYY' month_style='dmy' separator='/'>, value = <class 'formencode.api.NoDefault'>
state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 379 accept_day=True format='%d/%m/%Y' human_format='DD/MM/YYYY' month_style='dmy' separator='/'>, value = '12/20/2007', state = None

    def _convert_to_python(self, value, state):
        self.assert_string(value, state)
        month_style = self.month_style
        if not self.accept_day:
            month_style = 'ym' if month_style == 'ymd' else 'my'
        match = self._date_re[month_style].search(value)
        if not match:
            raise Invalid(
                self.message('badFormat', state,
                    format=self.human_format), value, state)
        groups = match.groups()
        if self.accept_day:
            if month_style == 'mdy':
                month, day, year = groups
            elif month_style == 'dmy':
                day, month, year = groups
            else:
                year, month, day = groups
            day = int(day)
            if not 1 <= day <= 31:
                raise Invalid(self.message('invalidDay', state), value, state)
        else:
            day = 1
            if month_style == 'my':
                month, year = groups
            else:
                year, month = groups
        month = self.make_month(month, state)
        if not 1 <= month <= 12:
>           raise Invalid(self.message('monthRange', state), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/validators.py:2092: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_euro_style>

    def test_euro_style(self):
        d = datetime.date(2007, 12, 20)
        dc = self.validator(month_style='dd/mm/yyyy')
        self.assertEqual(dc.to_python('20/12/2007'), d)
        self.assertEqual(dc.from_python(d), '20/12/2007')
        self.assertEqual(dc.to_python('20/Dec/2007'), d)
        self.assertEqual(dc.to_python('20/December/2007'), d)
        try:
            self.assertEqual(dc.to_python('12/20/2007'), d)
        except Invalid as e:
>           self.assertTrue('Please enter a month from 1 to 12' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:285: AssertionError
_________________________________________________________________ TestDateConverterValidator.test_us_style _________________________________________________________________

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_us_style>

    def test_us_style(self):
        d = datetime.date(2007, 12, 20)
        dc = self.validator()
        self.assertEqual(dc.to_python('12/20/2007'), d)
        self.assertEqual(dc.from_python(d), '12/20/2007')
        self.assertEqual(dc.to_python('Dec/20/2007'), d)
        self.assertEqual(dc.to_python('December/20/2007'), d)
        try:
>           self.assertEqual(dc.to_python('20/12/2007'), d)

formencode/tests/test_validators.py:262:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 399 accept_day=True format='%m/%d/%Y' human_format='MM/DD/YYYY' month_style='mdy' separator='/'>, value = <class 'formencode.api.NoDefault'>
state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DateConverter object 399 accept_day=True format='%m/%d/%Y' human_format='MM/DD/YYYY' month_style='mdy' separator='/'>, value = '20/12/2007', state = None

    def _convert_to_python(self, value, state):
        self.assert_string(value, state)
        month_style = self.month_style
        if not self.accept_day:
            month_style = 'ym' if month_style == 'ymd' else 'my'
        match = self._date_re[month_style].search(value)
        if not match:
            raise Invalid(
                self.message('badFormat', state,
                    format=self.human_format), value, state)
        groups = match.groups()
        if self.accept_day:
            if month_style == 'mdy':
                month, day, year = groups
            elif month_style == 'dmy':
                day, month, year = groups
            else:
                year, month, day = groups
            day = int(day)
            if not 1 <= day <= 31:
                raise Invalid(self.message('invalidDay', state), value, state)
        else:
            day = 1
            if month_style == 'my':
                month, year = groups
            else:
                year, month = groups
        month = self.make_month(month, state)
        if not 1 <= month <= 12:
>           raise Invalid(self.message('monthRange', state), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/validators.py:2092: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_validators.TestDateConverterValidator testMethod=test_us_style>

    def test_us_style(self):
        d = datetime.date(2007, 12, 20)
        dc = self.validator()
        self.assertEqual(dc.to_python('12/20/2007'), d)
        self.assertEqual(dc.from_python(d), '12/20/2007')
        self.assertEqual(dc.to_python('Dec/20/2007'), d)
        self.assertEqual(dc.to_python('December/20/2007'), d)
        try:
            self.assertEqual(dc.to_python('20/12/2007'), d)
        except Invalid as e:
>           self.assertTrue('Please enter a month from 1 to 12' in unicode(e))
E           AssertionError: False is not true

formencode/tests/test_validators.py:264: AssertionError
____________________________________________________________________ TestNotOneValidator.test_to_python ____________________________________________________________________

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        nov = NotOneValidator()
        self.assertEqual(nov.to_python('0'), 0)
        try:
>           nov.to_python('1')

formencode/tests/test_subclassing.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 535>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 535>, value = 1, state = None

    def _convert_to_python(self, value, state):
        value = super(NotOneValidator, self)._convert_to_python(value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:129: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        nov = NotOneValidator()
        self.assertEqual(nov.to_python('0'), 0)
        try:
            nov.to_python('1')
        except Invalid as e:
>           self.assertTrue(
                'must not be 1' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:147: AssertionError
________________________________________________________________ TestNotOneValidator.test_to_python_number _________________________________________________________________

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python_number>

    def test_to_python_number(self):
        nov = NotOneValidator(number=42)
        self.assertEqual(nov.to_python('0'), 0)
        self.assertEqual(nov.to_python('1'), 1)
        self.assertEqual(nov.to_python('2'), 2)
        try:
>           nov.to_python('42')

formencode/tests/test_subclassing.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 536 number=42>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 536 number=42>, value = 42, state = None

    def _convert_to_python(self, value, state):
        value = super(NotOneValidator, self)._convert_to_python(value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:129: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python_number>

    def test_to_python_number(self):
        nov = NotOneValidator(number=42)
        self.assertEqual(nov.to_python('0'), 0)
        self.assertEqual(nov.to_python('1'), 1)
        self.assertEqual(nov.to_python('2'), 2)
        try:
            nov.to_python('42')
        except Invalid as e:
>           self.assertTrue(
                'must not be 42' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:162: AssertionError
_________________________________________________________________ TestNotOneValidator.test_to_python_range _________________________________________________________________

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python_range>

    def test_to_python_range(self):
        nov = NotOneValidator(min=40, max=49, number=42)
        self.assertRaises(Invalid, nov.to_python, '0')
        self.assertRaises(Invalid, nov.to_python, '1')
        self.assertRaises(Invalid, nov.to_python, '2')
        self.assertRaises(Invalid, nov.to_python, '39')
        self.assertEqual(nov.to_python('40'), 40)
        self.assertEqual(nov.to_python('41'), 41)
        try:
>           nov.to_python('42')

formencode/tests/test_subclassing.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 537 max=49 min=40 number=42>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <NotOneValidator object 537 max=49 min=40 number=42>, value = 42, state = None

    def _convert_to_python(self, value, state):
        value = super(NotOneValidator, self)._convert_to_python(value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:129: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestNotOneValidator testMethod=test_to_python_range>

    def test_to_python_range(self):
        nov = NotOneValidator(min=40, max=49, number=42)
        self.assertRaises(Invalid, nov.to_python, '0')
        self.assertRaises(Invalid, nov.to_python, '1')
        self.assertRaises(Invalid, nov.to_python, '2')
        self.assertRaises(Invalid, nov.to_python, '39')
        self.assertEqual(nov.to_python('40'), 40)
        self.assertEqual(nov.to_python('41'), 41)
        try:
            nov.to_python('42')
        except Invalid as e:
>           self.assertTrue(
                'must not be 42' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:178: AssertionError
___________________________________________________________________ TestCustomValidator.test_from_python ___________________________________________________________________

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_from_python>

    def test_from_python(self):
        cv = CustomValidator()
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
>           cv.from_python(2)

formencode/tests/test_subclassing.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 539>, value = <class 'formencode.api.NoDefault'>, state = None

    def from_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            if not self.accept_python:
                if self.is_empty(value):
                    if self.not_empty:
                        raise Invalid(self.message('empty', state),
                                      value, state)
                    return self.empty_value(value)
                vp = self._validate_python
                if vp and vp is not self._validate_noop:
                    vp(value, state)
                fp = self._convert_from_python
                if fp:
                    value = fp(value, state)
                vo = self._validate_other
                if vo and vo is not self._validate_noop:
                    vo(value, state)
            else:
                if self.is_empty(value):
                    return self.empty_value(value)
                fp = self._convert_from_python
                if fp:
>                   value = fp(value, state)

formencode/api.py:540:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 539>, value = 2, state = None

    def _convert_from_python(self, value, state):
        if value == 2:
>           raise Invalid(self.message(
                'custom', state, number='two'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:26: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_from_python>

    def test_from_python(self):
        cv = CustomValidator()
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
            cv.from_python(2)
        except Invalid as e:
>           self.assertTrue(
                'two is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:81: AssertionError
____________________________________________________________________ TestCustomValidator.test_to_python ____________________________________________________________________

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_to_python>

    def test_to_python(self):
        cv = CustomValidator()
        self.assertEqual(cv.to_python('0'), 0)
        try:
>           cv.to_python('1')

formencode/tests/test_subclassing.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 540>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 540>, value = '1', state = None

    def _convert_to_python(self, value, state):
        if value == '1':
>           raise Invalid(self.message(
                'custom', state, number='one'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:20: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_to_python>

    def test_to_python(self):
        cv = CustomValidator()
        self.assertEqual(cv.to_python('0'), 0)
        try:
            cv.to_python('1')
        except Invalid as e:
>           self.assertTrue(
                'one is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:53: AssertionError
______________________________________________________________ TestCustomValidator.test_from_python_no_accept ______________________________________________________________

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_from_python_no_accept>

    def test_from_python_no_accept(self):
        cv = CustomValidator(accept_python=False)
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
>           cv.from_python(2)

formencode/tests/test_subclassing.py:94:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 541 accept_python=False>, value = <class 'formencode.api.NoDefault'>, state = None

    def from_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            if not self.accept_python:
                if self.is_empty(value):
                    if self.not_empty:
                        raise Invalid(self.message('empty', state),
                                      value, state)
                    return self.empty_value(value)
                vp = self._validate_python
                if vp and vp is not self._validate_noop:
                    vp(value, state)
                fp = self._convert_from_python
                if fp:
>                   value = fp(value, state)

formencode/api.py:531:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <CustomValidator object 541 accept_python=False>, value = 2, state = None

    def _convert_from_python(self, value, state):
        if value == 2:
>           raise Invalid(self.message(
                'custom', state, number='two'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:26: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestCustomValidator testMethod=test_from_python_no_accept>

    def test_from_python_no_accept(self):
        cv = CustomValidator(accept_python=False)
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
            cv.from_python(2)
        except Invalid as e:
>           self.assertTrue(
                'two is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:96: AssertionError
_________________________________________________________________ TestAllAndNotOneValidator.test_to_python _________________________________________________________________

self = <formencode.tests.test_subclassing.TestAllAndNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        cav = self.validator
        self.assertRaises(Invalid, cav.to_python, '1')
        self.assertRaises(Invalid, cav.to_python, '2')
        self.assertEqual(cav.to_python('3'), 3)
        try:
>           cav.to_python('4')

formencode/tests/test_subclassing.py:245:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 551 min=3>, <Int object 552 max=5>]>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 551 min=3>, <Int object 552 max=5>]>, value = '4', state = None

    def _convert_to_python(self, value, state=None):
>       return self._attempt_convert(value, state,
                                    to_python)

formencode/compound.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 551 min=3>, <Int object 552 max=5>]>, value = 4, state = None, validate = <function to_python at 0x7f4ae4955c10>

    def _attempt_convert(self, value, state, validate):
        value = super(AllAndNotOneValidator, self)._attempt_convert(
            value, state, validate)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing.py:224: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing.TestAllAndNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        cav = self.validator
        self.assertRaises(Invalid, cav.to_python, '1')
        self.assertRaises(Invalid, cav.to_python, '2')
        self.assertEqual(cav.to_python('3'), 3)
        try:
            cav.to_python('4')
        except Invalid as e:
>           self.assertTrue(
                'must not be 4' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing.py:247: AssertionError
____________________________________________________________ TestDeprecatedNotOneValidator.test_to_python_range ____________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python_range>

    def test_to_python_range(self):
        nov = DeprecatedNotOneValidator(min=40, max=49, number=42)
        with warnings.catch_warnings(record=True):
            self.assertRaises(Invalid, nov.to_python, '0')
            self.assertRaises(Invalid, nov.to_python, '1')
            self.assertRaises(Invalid, nov.to_python, '2')
            self.assertRaises(Invalid, nov.to_python, '39')
            self.assertEqual(nov.to_python('40'), 40)
            self.assertEqual(nov.to_python('41'), 41)
            try:
>               nov.to_python('42')

formencode/tests/test_subclassing_old.py:208:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 559 max=49 min=40 number=42>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 559 max=49 min=40 number=42>, value = 42, state = None

    def _to_python(self, value, state):
        value = super(DeprecatedNotOneValidator, self)._to_python(
            value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:149: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python_range>

    def test_to_python_range(self):
        nov = DeprecatedNotOneValidator(min=40, max=49, number=42)
        with warnings.catch_warnings(record=True):
            self.assertRaises(Invalid, nov.to_python, '0')
            self.assertRaises(Invalid, nov.to_python, '1')
            self.assertRaises(Invalid, nov.to_python, '2')
            self.assertRaises(Invalid, nov.to_python, '39')
            self.assertEqual(nov.to_python('40'), 40)
            self.assertEqual(nov.to_python('41'), 41)
            try:
                nov.to_python('42')
            except Invalid as e:
>               self.assertTrue(
                    'must not be 42' in str(e), e)
E               AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:210: AssertionError
_______________________________________________________________ TestDeprecatedNotOneValidator.test_to_python _______________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        nov = DeprecatedNotOneValidator()
        with warnings.catch_warnings(record=True):
            self.assertEqual(nov.to_python('0'), 0)
            try:
>               nov.to_python('1')

formencode/tests/test_subclassing_old.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 560>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 560>, value = 1, state = None

    def _to_python(self, value, state):
        value = super(DeprecatedNotOneValidator, self)._to_python(
            value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:149: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        nov = DeprecatedNotOneValidator()
        with warnings.catch_warnings(record=True):
            self.assertEqual(nov.to_python('0'), 0)
            try:
                nov.to_python('1')
            except Invalid as e:
>               self.assertTrue(
                    'must not be 1' in str(e), e)
E               AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:177: AssertionError
___________________________________________________________ TestDeprecatedNotOneValidator.test_to_python_number ____________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python_number>

    def test_to_python_number(self):
        nov = DeprecatedNotOneValidator(number=42)
        with warnings.catch_warnings(record=True):
            self.assertEqual(nov.to_python('0'), 0)
            self.assertEqual(nov.to_python('1'), 1)
            self.assertEqual(nov.to_python('2'), 2)
            try:
>               nov.to_python('42')

formencode/tests/test_subclassing_old.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 561 number=42>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedNotOneValidator object 561 number=42>, value = 42, state = None

    def _to_python(self, value, state):
        value = super(DeprecatedNotOneValidator, self)._to_python(
            value, state)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:149: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedNotOneValidator testMethod=test_to_python_number>

    def test_to_python_number(self):
        nov = DeprecatedNotOneValidator(number=42)
        with warnings.catch_warnings(record=True):
            self.assertEqual(nov.to_python('0'), 0)
            self.assertEqual(nov.to_python('1'), 1)
            self.assertEqual(nov.to_python('2'), 2)
            try:
                nov.to_python('42')
            except Invalid as e:
>               self.assertTrue(
                    'must not be 42' in str(e), e)
E               AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:193: AssertionError
____________________________________________________________ TestDeprecatedAllAndNotOneValidator.test_to_python ____________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedAllAndNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        cav = self.validator
        with warnings.catch_warnings(record=True):
            self.assertRaises(Invalid, cav.to_python, '1')
            self.assertRaises(Invalid, cav.to_python, '2')
            self.assertEqual(cav.to_python('3'), 3)
            try:
>               cav.to_python('4')

formencode/tests/test_subclassing_old.py:299:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 574 min=3>, <Int object 575 max=5>]>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 574 min=3>, <Int object 575 max=5>]>, value = '4', state = None

    def _convert_to_python(self, value, state=None):
>       return self._attempt_convert(value, state,
                                    to_python)

formencode/compound.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <All [<Int object 574 min=3>, <Int object 575 max=5>]>, value = 4, state = None, validate = <function to_python at 0x7f4ae4955c10>

    def attempt_convert(self, value, state, validate):
        value = super(DeprecatedAllAndNotOneValidator,
            self).attempt_convert(value, state, validate)
        if value == self.number:
>           raise Invalid(self.message(
                'custom', state, number=self.number), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:268: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedAllAndNotOneValidator testMethod=test_to_python>

    def test_to_python(self):
        cav = self.validator
        with warnings.catch_warnings(record=True):
            self.assertRaises(Invalid, cav.to_python, '1')
            self.assertRaises(Invalid, cav.to_python, '2')
            self.assertEqual(cav.to_python('3'), 3)
            try:
                cav.to_python('4')
            except Invalid as e:
>               self.assertTrue(
                    'must not be 4' in str(e), e)
E               AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:301: AssertionError
______________________________________________________________ TestDeprecatedCustomValidator.test_from_python ______________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_from_python>

    def test_from_python(self):
        cv = DeprecatedCustomValidator()
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
>           cv.from_python(2)

formencode/tests/test_subclassing_old.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 580>, value = <class 'formencode.api.NoDefault'>, state = None

    def from_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            if not self.accept_python:
                if self.is_empty(value):
                    if self.not_empty:
                        raise Invalid(self.message('empty', state),
                                      value, state)
                    return self.empty_value(value)
                vp = self._validate_python
                if vp and vp is not self._validate_noop:
                    vp(value, state)
                fp = self._convert_from_python
                if fp:
                    value = fp(value, state)
                vo = self._validate_other
                if vo and vo is not self._validate_noop:
                    vo(value, state)
            else:
                if self.is_empty(value):
                    return self.empty_value(value)
                fp = self._convert_from_python
                if fp:
>                   value = fp(value, state)

formencode/api.py:540:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 580>, value = 2, state = None

    def _from_python(self, value, state):
        if value == 2:
>           raise Invalid(self.message(
                'custom', state, number='two'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:31: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_from_python>

    def test_from_python(self):
        cv = DeprecatedCustomValidator()
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
            cv.from_python(2)
        except Invalid as e:
>           self.assertTrue(
                'two is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:97: AssertionError
_________________________________________________________ TestDeprecatedCustomValidator.test_from_python_no_accept _________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_from_python_no_accept>

    def test_from_python_no_accept(self):
        cv = DeprecatedCustomValidator(accept_python=False)
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
>           cv.from_python(2)

formencode/tests/test_subclassing_old.py:110:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 581 accept_python=False>, value = <class 'formencode.api.NoDefault'>, state = None

    def from_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            if not self.accept_python:
                if self.is_empty(value):
                    if self.not_empty:
                        raise Invalid(self.message('empty', state),
                                      value, state)
                    return self.empty_value(value)
                vp = self._validate_python
                if vp and vp is not self._validate_noop:
                    vp(value, state)
                fp = self._convert_from_python
                if fp:
>                   value = fp(value, state)

formencode/api.py:531:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 581 accept_python=False>, value = 2, state = None

    def _from_python(self, value, state):
        if value == 2:
>           raise Invalid(self.message(
                'custom', state, number='two'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:31: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_from_python_no_accept>

    def test_from_python_no_accept(self):
        cv = DeprecatedCustomValidator(accept_python=False)
        self.assertEqual(cv.from_python(0), '0')
        self.assertEqual(cv.from_python(1), '1')
        try:
            cv.from_python(2)
        except Invalid as e:
>           self.assertTrue(
                'two is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:112: AssertionError
_______________________________________________________________ TestDeprecatedCustomValidator.test_to_python _______________________________________________________________

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_to_python>

    def test_to_python(self):
        cv = DeprecatedCustomValidator()
        self.assertEqual(cv.to_python('0'), 0)
        try:
>           cv.to_python('1')

formencode/tests/test_subclassing_old.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 583>, value = <class 'formencode.api.NoDefault'>, state = None

    def to_python(self, value, state=None):
        try:
            if self.strip and isinstance(value, six.string_types):
                value = value.strip()
            elif hasattr(value, 'mixed'):
                # Support Paste's MultiDict
                value = value.mixed()
            if self.is_empty(value):
                if self.not_empty:
                    raise Invalid(self.message('empty', state), value, state)
                if self.if_empty is not NoDefault:
                    return self.if_empty
                return self.empty_value(value)
            vo = self._validate_other
            if vo and vo is not self._validate_noop:
                vo(value, state)
            tp = self._convert_to_python
            if tp:
>               value = tp(value, state)

formencode/api.py:506:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <DeprecatedCustomValidator object 583>, value = '1', state = None

    def _to_python(self, value, state):
        if value == '1':
>           raise Invalid(self.message(
                'custom', state, number='one'), value, state)
E           formencode.api.Invalid: builtins dummy

formencode/tests/test_subclassing_old.py:25: Invalid

During handling of the above exception, another exception occurred:

self = <formencode.tests.test_subclassing_old.TestDeprecatedCustomValidator testMethod=test_to_python>

    def test_to_python(self):
        cv = DeprecatedCustomValidator()
        self.assertEqual(cv.to_python('0'), 0)
        try:
            cv.to_python('1')
        except Invalid as e:
>           self.assertTrue(
                'one is invalid' in str(e), e)
E           AssertionError: False is not true : builtins dummy

formencode/tests/test_subclassing_old.py:69: AssertionError
============================================================================= warnings summary =============================================================================
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED formencode/tests/test_i18n.py::test_builtins - AssertionError: assert 'Please enter a value' == 'builtins dummy'
FAILED formencode/tests/test_validators.py::TestForEachValidator::test_foreach_if_missing - AssertionError: {'people': 'builtins dummy'} != {'people': 'Please add a pers...
FAILED formencode/tests/test_validators.py::TestRequireIfMissingValidator::test_present - AssertionError: {'phone_type': 'builtins dummy'} != {'phone_type': 'Please ente...
FAILED formencode/tests/test_validators.py::TestRequireIfMissingValidator::test_zero - AssertionError: {'operator': 'builtins dummy'} != {'operator': 'Please enter a val...
FAILED formencode/tests/test_validators.py::TestRequireIfMissingValidator::test_missing - AssertionError: {'phone_type': 'builtins dummy'} != {'phone_type': 'Please ente...
FAILED formencode/tests/test_validators.py::TestOneOfValidator::test_mixed_list - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestTimeConverterValidator::test_time - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestRequireIfMatchingValidator::test_matching - AssertionError: {'mobile': 'builtins dummy'} != {'mobile': 'Please enter a va...
FAILED formencode/tests/test_validators.py::TestRequireIfMatchingValidator::test_matching_multiple_required - AssertionError: {'mobile': 'builtins dummy'} != {'mobile': ...
FAILED formencode/tests/test_validators.py::TestIPAddressValidator::test_leading_zeros - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestIPAddressValidator::test_leading_zeros_allowed - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestDateConverterValidator::test_iso_style - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestDateConverterValidator::test_bad_dates - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestDateConverterValidator::test_no_day - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestDateConverterValidator::test_euro_style - AssertionError: False is not true
FAILED formencode/tests/test_validators.py::TestDateConverterValidator::test_us_style - AssertionError: False is not true
FAILED formencode/tests/test_subclassing.py::TestNotOneValidator::test_to_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestNotOneValidator::test_to_python_number - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestNotOneValidator::test_to_python_range - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestCustomValidator::test_from_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestCustomValidator::test_to_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestCustomValidator::test_from_python_no_accept - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing.py::TestAllAndNotOneValidator::test_to_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedNotOneValidator::test_to_python_range - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedNotOneValidator::test_to_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedNotOneValidator::test_to_python_number - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedAllAndNotOneValidator::test_to_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedCustomValidator::test_from_python - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedCustomValidator::test_from_python_no_accept - AssertionError: False is not true : builtins dummy
FAILED formencode/tests/test_subclassing_old.py::TestDeprecatedCustomValidator::test_to_python - AssertionError: False is not true : builtins dummy

Looks like formencode test suite depends on exact order of executed units.
I'm using pytest-randomly which exposes that kind of issues. That issue can be sdiagnosed using https://github.com/mrbean-bremen/pytest-find-dependencies/.

@kloczek
Copy link
Author

kloczek commented Dec 5, 2021

After disable pytest-randomly and deselect failing unit there are some deprecation warnings

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly --deselect 'formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]'
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1, configfile: pytest.ini
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, cov-2.12.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0, tornasync-0.6.0.post2, console-scripts-1.2.0, trio-0.7.0, timeout-2.0.1, asyncio-0.16.0, freezegun-0.4.2, flake8-1.0.7, pyfakefs-4.5.3, hypothesis-6.29.3, benchmark-3.4.1, profiling-1.7.0, datadir-1.3.1, regressions-2.2.0, rerunfailures-9.1.1, yagot-0.5.0, requests-mock-1.9.3, django-4.5.1
collected 268 items / 1 deselected / 267 selected

formencode/tests/test_cc.py ..                                                                                                                                       [  0%]
formencode/tests/test_compound.py .................                                                                                                                  [  7%]
formencode/tests/test_context.py ...                                                                                                                                 [  8%]
formencode/tests/test_declarative.py ....                                                                                                                            [  9%]
formencode/tests/test_doctest_xml_compare.py .                                                                                                                       [ 10%]
formencode/tests/test_doctests.py ........                                                                                                                           [ 13%]
formencode/tests/test_email.py ....                                                                                                                                  [ 14%]
formencode/tests/test_htmlfill.py ..............................................                                                                                     [ 31%]
formencode/tests/test_htmlfill_control.py .......                                                                                                                    [ 34%]
formencode/tests/test_htmlgen.py .......                                                                                                                             [ 37%]
formencode/tests/test_htmlrename.py .                                                                                                                                [ 37%]
formencode/tests/test_i18n.py ........................                                                                                                               [ 46%]
formencode/tests/test_schema.py .......................                                                                                                              [ 55%]
formencode/tests/test_subclassing.py ...............                                                                                                                 [ 60%]
formencode/tests/test_subclassing_old.py ................                                                                                                            [ 66%]
formencode/tests/test_validators.py ..............................................................................                                                   [ 95%]
formencode/tests/test_variabledecode.py ...........                                                                                                                  [100%]

============================================================================= warnings summary =============================================================================
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================== 267 passed, 1 deselected, 6 warnings in 3.08s ===============================================================

@kloczek
Copy link
Author

kloczek commented Dec 5, 2021

It is yet another small issue.
Sphins shows one warning.

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.3.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 28 added, 0 changed, 0 removed
/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/declarative.py:167: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.
  setattr(cls, name, cls(
/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/declarative.py:167: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.
  setattr(cls, name, cls(
reading sources... [100%] whatsnew-2.0
/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/htmlfill.py:docstring of formencode.htmlfill.ignore_formatter:1: WARNING: duplicate object description of formencode.htmlfill.ignore_formatter, other instance in modules/htmlfill, use :noindex: for one of them
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-formencode.3 { whatsnew-2.0 whatsnew-1.3 whatsnew-1.2.5 whatsnew-0-to-1.2.4 Validator htmlfill ToDo Design history i18n modules modules/api modules/compound modules/declarative modules/doctest_xml_compare modules/exc modules/foreach modules/htmlrename modules/htmlfill modules/htmlfill_schemabuilder modules/htmlgen modules/national modules/schema modules/validators modules/variabledecode community download } done
build succeeded, 1 warning.

@lambacck
Copy link
Contributor

lambacck commented Jan 4, 2022

You should be able to adapt the commands from the make init and make ci steps in the Makefile to make it work. I also have just pushed a big refactor around using setup.cfg instead of setup.py in #174

@kloczek
Copy link
Author

kloczek commented Jan 4, 2022

I'm already using pep517 based build.

Issue with test suite is that as long as exect unit depends on what has been done in prev unit using pytest to execute exact sing;e unit (by `pytest <file.py>::<test_unit>) in such cases will show error/fail result.
This is why such test suite issues should be chased and fixed.

@kloczek
Copy link
Author

kloczek commented Jan 13, 2022

OK I've manage to reduce number of failing units to just one.
Looks like dnspython was missing.

Nevertheless I still have one failing unit and looks like it fails on some locale checks.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-formencode-2.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1, configfile: pytest.ini
collected 268 items

formencode/tests/test_cc.py ..                                                                                                                                       [  0%]
formencode/tests/test_compound.py .................                                                                                                                  [  7%]
formencode/tests/test_context.py ...                                                                                                                                 [  8%]
formencode/tests/test_declarative.py ....                                                                                                                            [  9%]
formencode/tests/test_doctest_xml_compare.py .                                                                                                                       [ 10%]
formencode/tests/test_doctests.py ......F..                                                                                                                          [ 13%]
formencode/tests/test_email.py ....                                                                                                                                  [ 14%]
formencode/tests/test_htmlfill.py ..............................................                                                                                     [ 32%]
formencode/tests/test_htmlfill_control.py .......                                                                                                                    [ 34%]
formencode/tests/test_htmlgen.py .......                                                                                                                             [ 37%]
formencode/tests/test_htmlrename.py .                                                                                                                                [ 37%]
formencode/tests/test_i18n.py ........................                                                                                                               [ 46%]
formencode/tests/test_schema.py .......................                                                                                                              [ 55%]
formencode/tests/test_subclassing.py ...............                                                                                                                 [ 60%]
formencode/tests/test_subclassing_old.py ................                                                                                                            [ 66%]
formencode/tests/test_validators.py ..............................................................................                                                   [ 95%]
formencode/tests/test_variabledecode.py ...........                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
__________________________________________________________ test_doctests[_wrapper-formencode.national-False-True] __________________________________________________________

testfn = <function set_func_description.<locals>._wrapper at 0x7f7104d78c10>
document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    @pytest.mark.parametrize("testfn,document,verbose,raise_error", list(collect_functions()))
    def test_doctests(testfn,document,verbose,raise_error):
        """Generate each doctest."""
>       testfn(document, verbose, raise_error)

formencode/tests/test_doctests.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
formencode/tests/test_doctests.py:73: in _wrapper
    fn(*a_test_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    def doctest_module(document, verbose, raise_error):
        failure_count, test_count = doctest.testmod(document,
                optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL,
                verbose=verbose)
        if raise_error:
            assert test_count > 0
>           assert failure_count == 0
E           assert 11 == 0

formencode/tests/test_doctests.py:67: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 423, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Germany')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[0]>", line 1, in <module>
        CountryValidator.to_python('Germany')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 425, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Finland')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[1]>", line 1, in <module>
        CountryValidator.to_python('Finland')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 427, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('UNITED STATES')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[2]>", line 1, in <module>
        CountryValidator.to_python('UNITED STATES')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 429, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Krakovia')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That country is not listed in ISO 3166
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[3]>", line 1, in <module>
        CountryValidator.to_python('Krakovia')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 433, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('DE')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[4]>", line 1, in <module>
        CountryValidator.from_python('DE')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 435, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('FI')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[5]>", line 1, in <module>
        CountryValidator.from_python('FI')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 825, in formencode.national.LanguageValidator
Failed example:
    l.to_python('German')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[1]>", line 1, in <module>
        l.to_python('German')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 827, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Chinese')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[2]>", line 1, in <module>
        l.to_python('Chinese')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 829, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Klingonian')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That language is not listed in ISO 639
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[3]>", line 1, in <module>
        l.to_python('Klingonian')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 833, in formencode.national.LanguageValidator
Failed example:
    l.from_python('de')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[4]>", line 1, in <module>
        l.from_python('de')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 835, in formencode.national.LanguageValidator
Failed example:
    l.from_python('zh')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[5]>", line 1, in <module>
        l.from_python('zh')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
2 items had failures:
   6 of   6 in formencode.national.CountryValidator
   5 of   6 in formencode.national.LanguageValidator
***Test Failed*** 11 failures.
============================================================================= warnings summary =============================================================================
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/declarative.py:167: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.
    setattr(cls, name, cls(

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  <doctest formencode.national.LanguageValidator[0]>:1: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True] - assert 11 == 0
================================================================ 1 failed, 267 passed, 8 warnings in 3.00s =================================================================

I'm not sure what is still missing in my env.
Do you hae any suggestions? :)

@kloczek
Copy link
Author

kloczek commented Jan 13, 2022

After deselecting failing unit still there are some pytest warnings

============================================================================= warnings summary =============================================================================
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================== 267 passed, 1 deselected, 6 warnings in 2.48s ===============================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants