@@ -874,7 +874,6 @@ def test_is_ip(self):
874874 self .assertTrue (is_ip ('[2001:db8:85a3::8a2e:370:7334]' ))
875875 self .assertTrue (is_ip ('2001:db8:85a3::8a2e:370:7334' ))
876876 self .assertTrue (is_ip ('192.168.0.1' ))
877-
878877 self .assertFalse (is_ip ('256.256.256.256' ))
879878 self .assertFalse (is_ip ('[::2001:db8:85a3::]' ))
880879 self .assertFalse (is_ip ('acme.com' ))
@@ -890,13 +889,15 @@ def test_reach(self):
890889 self .assertEqual (reach ("" ), "" )
891890 self .assertEqual (reach ("192.168.0.1" ), "192.168.0.1" )
892891 self .assertEqual (reach ("[::1]" ), "[::1]" )
893- self .assertEqual (reach ("[2001:db8:85a3::8a2e:370:7334]" ), "[2001:db8:85a3::8a2e:370:7334]" )
892+ self .assertEqual (reach ("[2001:db8:85a3::8a2e:370:7334]" ),
893+ "[2001:db8:85a3::8a2e:370:7334]" )
894894
895895 def test_domain_match (self ):
896896 self .assertTrue (domain_match ("192.168.1.1" , "192.168.1.1" ))
897897 self .assertTrue (domain_match ("[::1]" , "[::1]" ))
898898 self .assertFalse (domain_match ("[::1]" , "::1" ))
899- self .assertTrue (domain_match ("[2001:db8:85a3::8a2e:370:7334]" , "[2001:db8:85a3::8a2e:370:7334]" ))
899+ self .assertTrue (domain_match ("[2001:db8:85a3::8a2e:370:7334]" ,
900+ "[2001:db8:85a3::8a2e:370:7334]" ))
900901 self .assertFalse (domain_match ("192.168.1.1" , ".168.1.1" ))
901902 self .assertTrue (domain_match ("x.y.com" , "x.Y.com" ))
902903 self .assertTrue (domain_match ("x.y.com" , ".Y.com" ))
@@ -1190,7 +1191,11 @@ def test_domain_block(self):
11901191 c .add_cookie_header (req )
11911192 self .assertFalse (req .has_header ("Cookie" ))
11921193
1193- c .clear ()
1194+ def test_block_ip_domains (self ):
1195+ pol = DefaultCookiePolicy (
1196+ rfc2965 = True , blocked_domains = [])
1197+ c = CookieJar (policy = pol )
1198+ headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/" ]
11941199
11951200 pol .set_blocked_domains (["[::1]" ])
11961201 req = urllib .request .Request ("http://[::1]:8080" )
0 commit comments