diff options
author | pmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-04-29 17:15:38 +0000 |
---|---|---|
committer | pmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035> | 2010-04-29 17:15:38 +0000 |
commit | 0f749d257bcdef7b4e88262bb3eaa0f60c289dfc (patch) | |
tree | 0432dbe171c7d51317d20cc3a7c01e2d8d85d960 /trunk | |
parent | ef688ce950900a728ecf6f23a68dd7108e4e8408 (diff) | |
download | ipaddr-py-0f749d257bcdef7b4e88262bb3eaa0f60c289dfc.tar.gz |
+ fix issue where address exclude would puke if you tried to exclude
and address from itself.
git-svn-id: https://ipaddr-py.googlecode.com/svn@162 09200d28-7f98-11dd-ad27-0f66e57d2035
Diffstat (limited to 'trunk')
-rw-r--r-- | trunk/ipaddr.py | 3 | ||||
-rwxr-xr-x | trunk/ipaddr_test.py | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/trunk/ipaddr.py b/trunk/ipaddr.py index b8d877f..80b04b9 100644 --- a/trunk/ipaddr.py +++ b/trunk/ipaddr.py @@ -695,6 +695,9 @@ class _BaseNet(_IPAddrBase): if other not in self: raise ValueError('%s not contained in %s' % (str(other), str(self))) + if other == self: + return [] + ret_addrs = [] # Make sure we're comparing the network of other. diff --git a/trunk/ipaddr_test.py b/trunk/ipaddr_test.py index 623452a..04cf8d9 100755 --- a/trunk/ipaddr_test.py +++ b/trunk/ipaddr_test.py @@ -792,6 +792,7 @@ class IpaddrUnitTest(unittest.TestCase): [ipaddr.IPNetwork('10.1.1.64/26'), ipaddr.IPNetwork('10.1.1.128/25')]) self.assertRaises(ValueError, addr1.address_exclude, addr3) + self.assertEqual(addr1.address_exclude(addr1), []) def testHash(self): self.assertEquals(hash(ipaddr.IPNetwork('10.1.1.0/24')), |