[New-bugs-announce] [issue15888] ipaddress HOWTO examples have some errors

Chris Jerdonek report at bugs.python.org
Sun Sep 9 13:32:29 CEST 2012


New submission from Chris Jerdonek:

The ipaddress HOWTO seems to have some errors in its interactive doctest examples.  Below are the errors after running the doctests for it using the regrtest patch posted to issue 15629.  (This is the first doc file for which I have used the modified script to open an issue.)

The errors seem valid to me on casual inspection.

Note that you need to add an initial ">>> import ipaddress" at the beginning of the first doctest example to have these actually run.


----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 146, in ipaddress.rst
Failed example:
    ipaddress.ip_network('2001:db8::1/96')
Exception raised:
    Traceback (most recent call last):
      File "Lib/doctest.py", line 1287, in __run
        compileflags, 1), test.globs)
      File "<doctest ipaddress.rst[15]>", line 1, in <module>
        ipaddress.ip_network('2001:db8::1/96')
      File "Lib/ipaddress.py", line 79, in ip_network
        return IPv6Network(address, strict)
      File "Lib/ipaddress.py", line 2056, in __init__
        raise ValueError('%s has host bits set' % self)
    ValueError: 2001:db8::1/96 has host bits set
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 181, in ipaddress.rst
Failed example:
    net4.numhosts
Exception raised:
    Traceback (most recent call last):
      File "Lib/doctest.py", line 1287, in __run
        compileflags, 1), test.globs)
      File "<doctest ipaddress.rst[25]>", line 1, in <module>
        net4.numhosts
    AttributeError: 'IPv4Network' object has no attribute 'numhosts'
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 184, in ipaddress.rst
Failed example:
    net6.numhosts
Exception raised:
    Traceback (most recent call last):
      File "Lib/doctest.py", line 1287, in __run
        compileflags, 1), test.globs)
      File "<doctest ipaddress.rst[27]>", line 1, in <module>
        net6.numhosts
    AttributeError: 'IPv6Network' object has no attribute 'numhosts'
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 190, in ipaddress.rst
Failed example:
    for x in net4.hosts():
Exception raised:
    Traceback (most recent call last):
      File "Lib/doctest.py", line 1287, in __run
        compileflags, 1), test.globs)
      File "<doctest ipaddress.rst[29]>", line 1
        for x in net4.hosts():
                             ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 219, in ipaddress.rst
Failed example:
    addr6.exploded
Expected:
    '2001:0db8:0000:0000:0000:0000:0000:0000'
Got:
    '2001:0db8:0000:0000:0000:0000:0000:0001'
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 221, in ipaddress.rst
Failed example:
    addr6.compressed
Expected:
    '2001:db8::'
Got:
    '2001:db8::1'
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 244, in ipaddress.rst
Failed example:
    net6[1]
Expected:
    IPv6Address('2001::1')
Got:
    IPv6Address('2001:db8::1')
----------------------------------------------------------------------
File "Doc/howto/ipaddress.rst", line 246, in ipaddress.rst
Failed example:
    net6[-1]
Expected:
    IPv6Address('2001::ffff:ffff')
Got:
    IPv6Address('2001:db8::ffff:ffff')

----------
assignee: docs at python
components: Documentation
keywords: easy
messages: 170097
nosy: cjerdonek, docs at python, ncoghlan, pmoody
priority: normal
severity: normal
stage: needs patch
status: open
title: ipaddress HOWTO examples have some errors
type: behavior
versions: Python 3.3

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


More information about the New-bugs-announce mailing list