[issue27721] distutils strtobool returns 0 and 1 rather than False and True

Berker Peksag report at bugs.python.org
Tue Aug 9 19:55:17 EDT 2016


Berker Peksag added the comment:

Could you also update documentation in Doc/distutils/apiref.rst?

Also, test_strtobool in Lib/distutils/tests/test_util.py doesn't test the following case:

    >>> from distutils.util import strtobool
    >>> strtobool('x')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/berker/projects/cpython/default/Lib/distutils/util.py", line 317, in strtobool
        raise ValueError("invalid truth value %r" % (val,)) 
    ValueError: invalid truth value 'x'

Bonus points if you add a test for that :)

Thanks!

----------
nosy: +berker.peksag
stage: commit review -> patch review

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27721>
_______________________________________


More information about the Python-bugs-list mailing list