timmerk / ipaddr-py

Automatically exported from code.google.com/p/ipaddr-py
0 stars 0 forks source link

Patch: Construct networks with (ip, prefixlen) tuples #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've long found it annoying that you can only create non-trivial
IP*Network objects by parsing 'foo/prefixlen' strings.

Python 3.5's ipaddress module added 2-tuple (ip, prefixlen)
constructors, so I implemented the most-useful subset of the
feature (that is, integer prefixlens) for ipaddr-py.

Original issue reported on code.google.com by pma...@google.com on 19 Jul 2014 at 1:06

Attachments:

GoogleCodeExporter commented 9 years ago
I'm getting a test failure with this patch

......................................F..............................
======================================================================
FAIL: testInvalidStrings (__main__.IpaddrUnitTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./ipaddr_test.py", line 164, in testInvalidStrings
    ('2001:db8::'))
AssertionError: AddressValueError not raised

----------------------------------------------------------------------
Ran 69 tests in 0.053s

Original comment by pmo...@google.com on 25 Jul 2014 at 11:16

GoogleCodeExporter commented 9 years ago
Sorry, I must've added a last test and forgot to run it.

- ('2001:db8::'))
+ ('2001:db8::',))

Original comment by pma...@google.com on 25 Jul 2014 at 11:26

Attachments:

GoogleCodeExporter commented 9 years ago
thanks Paul. applied in c813f4790d10

Original comment by pmo...@google.com on 26 Jul 2014 at 4:18