forked from Rust-related/RustPython
Update ipaddress from CPython v3.12.3 (#5312)
Co-authored-by: CPython Developers <>
This commit is contained in:
6
Lib/ipaddress.py
vendored
6
Lib/ipaddress.py
vendored
@@ -1821,9 +1821,6 @@ class _BaseV6:
|
|||||||
def _explode_shorthand_ip_string(self):
|
def _explode_shorthand_ip_string(self):
|
||||||
"""Expand a shortened IPv6 address.
|
"""Expand a shortened IPv6 address.
|
||||||
|
|
||||||
Args:
|
|
||||||
ip_str: A string, the IPv6 address.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A string, the expanded IPv6 address.
|
A string, the expanded IPv6 address.
|
||||||
|
|
||||||
@@ -1941,6 +1938,9 @@ class IPv6Address(_BaseV6, _BaseAddress):
|
|||||||
return False
|
return False
|
||||||
return self._scope_id == getattr(other, '_scope_id', None)
|
return self._scope_id == getattr(other, '_scope_id', None)
|
||||||
|
|
||||||
|
def __reduce__(self):
|
||||||
|
return (self.__class__, (str(self),))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scope_id(self):
|
def scope_id(self):
|
||||||
"""Identifier of a particular zone of the address's scope.
|
"""Identifier of a particular zone of the address's scope.
|
||||||
|
|||||||
7
Lib/test/test_ipaddress.py
vendored
7
Lib/test/test_ipaddress.py
vendored
@@ -4,6 +4,7 @@
|
|||||||
"""Unittest for ipaddress module."""
|
"""Unittest for ipaddress module."""
|
||||||
|
|
||||||
|
|
||||||
|
import copy
|
||||||
import unittest
|
import unittest
|
||||||
import re
|
import re
|
||||||
import contextlib
|
import contextlib
|
||||||
@@ -542,11 +543,17 @@ class AddressTestCase_v6(BaseTestCase, CommonTestMixin_v6):
|
|||||||
|
|
||||||
def test_pickle(self):
|
def test_pickle(self):
|
||||||
self.pickle_test('2001:db8::')
|
self.pickle_test('2001:db8::')
|
||||||
|
self.pickle_test('2001:db8::%scope')
|
||||||
|
|
||||||
def test_weakref(self):
|
def test_weakref(self):
|
||||||
weakref.ref(self.factory('2001:db8::'))
|
weakref.ref(self.factory('2001:db8::'))
|
||||||
weakref.ref(self.factory('2001:db8::%scope'))
|
weakref.ref(self.factory('2001:db8::%scope'))
|
||||||
|
|
||||||
|
def test_copy(self):
|
||||||
|
addr = self.factory('2001:db8::%scope')
|
||||||
|
self.assertEqual(addr, copy.copy(addr))
|
||||||
|
self.assertEqual(addr, copy.deepcopy(addr))
|
||||||
|
|
||||||
|
|
||||||
class NetmaskTestMixin_v4(CommonTestMixin_v4):
|
class NetmaskTestMixin_v4(CommonTestMixin_v4):
|
||||||
"""Input validation on interfaces and networks is very similar"""
|
"""Input validation on interfaces and networks is very similar"""
|
||||||
|
|||||||
Reference in New Issue
Block a user