summaryrefslogtreecommitdiff
path: root/Lib/test/test_ipaddress.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-07-07 22:15:22 +1000
committerNick Coghlan <ncoghlan@gmail.com>2012-07-07 22:15:22 +1000
commitd1bf0e38f03a795012b9669fc5f1bb62940f584d (patch)
treeace76a51f3f7ef553ef400233798dba7cf016223 /Lib/test/test_ipaddress.py
parent27b867afd964eaeb6994b2eb33cec69229e53152 (diff)
downloadcpython-d1bf0e38f03a795012b9669fc5f1bb62940f584d.tar.gz
Issue 14814: Explain how to get more error detail in the ipaddress tutorial, and tweak the display for octet errors in IPv4 (noticed the formatting problem when adding to the docs)
Diffstat (limited to 'Lib/test/test_ipaddress.py')
-rw-r--r--Lib/test/test_ipaddress.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index 61ec0d6e40..2ac37e1c64 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -126,8 +126,8 @@ class AddressErrors_v4(ErrorReporting):
def test_octet_limit(self):
def assertBadOctet(addr, octet):
- msg = "Octet %d > 255 not permitted in %r"
- with self.assertAddressError(msg, octet, addr):
+ msg = "Octet %d (> 255) not permitted in %r" % (octet, addr)
+ with self.assertAddressError(re.escape(msg)):
ipaddress.IPv4Address(addr)
assertBadOctet("12345.67899.-54321.-98765", 12345)
@@ -310,7 +310,7 @@ class NetmaskErrorsMixin_v4:
assertBadAddress("google.com", "Expected 4 octets")
assertBadAddress("10/8", "Expected 4 octets")
assertBadAddress("::1.2.3.4", "Only decimal digits")
- assertBadAddress("1.2.3.256", "256 > 255")
+ assertBadAddress("1.2.3.256", re.escape("256 (> 255)"))
def test_netmask_errors(self):
def assertBadNetmask(addr, netmask):