File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1821,9 +1821,6 @@ def _string_from_ip_int(cls, ip_int=None):
18211821 def _explode_shorthand_ip_string (self ):
18221822 """Expand a shortened IPv6 address.
18231823
1824- Args:
1825- ip_str: A string, the IPv6 address.
1826-
18271824 Returns:
18281825 A string, the expanded IPv6 address.
18291826
@@ -1941,6 +1938,9 @@ def __eq__(self, other):
19411938 return False
19421939 return self ._scope_id == getattr (other , '_scope_id' , None )
19431940
1941+ def __reduce__ (self ):
1942+ return (self .__class__ , (str (self ),))
1943+
19441944 @property
19451945 def scope_id (self ):
19461946 """Identifier of a particular zone of the address's scope.
Original file line number Diff line number Diff line change 44"""Unittest for ipaddress module."""
55
66
7+ import copy
78import unittest
89import re
910import contextlib
@@ -542,11 +543,17 @@ def assertBadPart(addr, part):
542543
543544 def test_pickle (self ):
544545 self .pickle_test ('2001:db8::' )
546+ self .pickle_test ('2001:db8::%scope' )
545547
546548 def test_weakref (self ):
547549 weakref .ref (self .factory ('2001:db8::' ))
548550 weakref .ref (self .factory ('2001:db8::%scope' ))
549551
552+ def test_copy (self ):
553+ addr = self .factory ('2001:db8::%scope' )
554+ self .assertEqual (addr , copy .copy (addr ))
555+ self .assertEqual (addr , copy .deepcopy (addr ))
556+
550557
551558class NetmaskTestMixin_v4 (CommonTestMixin_v4 ):
552559 """Input validation on interfaces and networks is very similar"""
You can’t perform that action at this time.
0 commit comments