File tree 2 files changed +10
-3
lines changed
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):
1821
1821
def _explode_shorthand_ip_string (self ):
1822
1822
"""Expand a shortened IPv6 address.
1823
1823
1824
- Args:
1825
- ip_str: A string, the IPv6 address.
1826
-
1827
1824
Returns:
1828
1825
A string, the expanded IPv6 address.
1829
1826
@@ -1941,6 +1938,9 @@ def __eq__(self, other):
1941
1938
return False
1942
1939
return self ._scope_id == getattr (other , '_scope_id' , None )
1943
1940
1941
+ def __reduce__ (self ):
1942
+ return (self .__class__ , (str (self ),))
1943
+
1944
1944
@property
1945
1945
def scope_id (self ):
1946
1946
"""Identifier of a particular zone of the address's scope.
Original file line number Diff line number Diff line change 4
4
"""Unittest for ipaddress module."""
5
5
6
6
7
+ import copy
7
8
import unittest
8
9
import re
9
10
import contextlib
@@ -542,11 +543,17 @@ def assertBadPart(addr, part):
542
543
543
544
def test_pickle (self ):
544
545
self .pickle_test ('2001:db8::' )
546
+ self .pickle_test ('2001:db8::%scope' )
545
547
546
548
def test_weakref (self ):
547
549
weakref .ref (self .factory ('2001:db8::' ))
548
550
weakref .ref (self .factory ('2001:db8::%scope' ))
549
551
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
+
550
557
551
558
class NetmaskTestMixin_v4 (CommonTestMixin_v4 ):
552
559
"""Input validation on interfaces and networks is very similar"""
You can’t perform that action at this time.
0 commit comments