MCPcopy Index your code
hub / github.com/python/cpython / test_leading_zeros

Method test_leading_zeros

Lib/test/test_ipaddress.py:100–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

98class CommonTestMixin_v4(CommonTestMixin):
99
100 def test_leading_zeros(self):
101 # bpo-36384: no leading zeros to avoid ambiguity with octal notation
102 msg = "Leading zeros are not permitted in '\\d+'"
103 addresses = [
104 "000.000.000.000",
105 "192.168.000.001",
106 "016.016.016.016",
107 "001.000.008.016",
108 "01.2.3.40",
109 "1.02.3.40",
110 "1.2.03.40",
111 "1.2.3.040",
112 ]
113 for address in addresses:
114 with self.subTest(address=address):
115 with self.assertAddressError(msg):
116 self.factory(address)
117
118 def test_int(self):
119 self.assertInstancesEqual(0, "0.0.0.0")

Callers

nothing calls this directly

Calls 3

assertAddressErrorMethod · 0.80
subTestMethod · 0.45
factoryMethod · 0.45

Tested by

no test coverage detected