Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Delta Between Two Patch Sets: Lib/test/test_ipaddress.py

Issue 18802: ipaddress documentation errors
Left Patch Set: Created 6 years, 6 months ago
Right Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/ipaddress.rst ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # Copyright 2007 Google Inc. 1 # Copyright 2007 Google Inc.
2 # Licensed to PSF under a Contributor Agreement. 2 # Licensed to PSF under a Contributor Agreement.
3 3
4 """Unittest for ipaddress module.""" 4 """Unittest for ipaddress module."""
5 5
6 6
7 import unittest 7 import unittest
8 import re 8 import re
9 import contextlib 9 import contextlib
10 import functools 10 import functools
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 self.pickle_test('192.0.2.0/31') # IPV4LENGTH - 1 469 self.pickle_test('192.0.2.0/31') # IPV4LENGTH - 1
470 self.pickle_test('192.0.2.0') # IPV4LENGTH 470 self.pickle_test('192.0.2.0') # IPV4LENGTH
471 471
472 472
473 class InterfaceTestCase_v4(BaseTestCase, NetmaskTestMixin_v4): 473 class InterfaceTestCase_v4(BaseTestCase, NetmaskTestMixin_v4):
474 factory = ipaddress.IPv4Interface 474 factory = ipaddress.IPv4Interface
475 475
476 476
477 class NetworkTestCase_v4(BaseTestCase, NetmaskTestMixin_v4): 477 class NetworkTestCase_v4(BaseTestCase, NetmaskTestMixin_v4):
478 factory = ipaddress.IPv4Network 478 factory = ipaddress.IPv4Network
479
480 def test_no_mask(self):
481 self.assertEqual(
482 ipaddress.ip_network('1.2.3.4'),
483 ipaddress.IPv4Network('1.2.3.4/32')
484 )
479 485
480 486
481 class NetmaskTestMixin_v6(CommonTestMixin_v6): 487 class NetmaskTestMixin_v6(CommonTestMixin_v6):
482 """Input validation on interfaces and networks is very similar""" 488 """Input validation on interfaces and networks is very similar"""
483 489
484 def test_split_netmask(self): 490 def test_split_netmask(self):
485 addr = "cafe:cafe::/128/190" 491 addr = "cafe:cafe::/128/190"
486 with self.assertAddressError("Only one '/' permitted in %r" % addr): 492 with self.assertAddressError("Only one '/' permitted in %r" % addr):
487 self.factory(addr) 493 self.factory(addr)
488 494
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 def testsixtofour(self): 1944 def testsixtofour(self):
1939 sixtofouraddr = ipaddress.ip_address('2002:ac1d:2d64::1') 1945 sixtofouraddr = ipaddress.ip_address('2002:ac1d:2d64::1')
1940 bad_addr = ipaddress.ip_address('2000:ac1d:2d64::1') 1946 bad_addr = ipaddress.ip_address('2000:ac1d:2d64::1')
1941 self.assertEqual(ipaddress.IPv4Address('172.29.45.100'), 1947 self.assertEqual(ipaddress.IPv4Address('172.29.45.100'),
1942 sixtofouraddr.sixtofour) 1948 sixtofouraddr.sixtofour)
1943 self.assertFalse(bad_addr.sixtofour) 1949 self.assertFalse(bad_addr.sixtofour)
1944 1950
1945 1951
1946 if __name__ == '__main__': 1952 if __name__ == '__main__':
1947 unittest.main() 1953 unittest.main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+