@@ -66,6 +66,19 @@ def test_match_context():
66
66
assert match .context == {"host" : "foo.bar" , "slug" : "baz" }
67
67
68
68
69
+ @pytest .mark .parametrize (
70
+ "kwargs,url,expected" ,
71
+ [
72
+ ({"params__eq" : {}}, "https://foo.bar/" , True ),
73
+ ({"params__eq" : {}}, "https://foo.bar/?x=y" , False ),
74
+ ({"params__contains" : {}}, "https://foo.bar/?x=y" , True ),
75
+ ],
76
+ )
77
+ def test_m_pattern (kwargs , url , expected ):
78
+ request = httpx .Request ("GET" , url )
79
+ assert bool (M (host = "foo.bar" , ** kwargs ).match (request )) is expected
80
+
81
+
69
82
@pytest .mark .parametrize (
70
83
"lookup,value,expected" ,
71
84
[
@@ -217,6 +230,8 @@ def test_path_pattern():
217
230
(Lookup .EQUAL , "y=2" , "https://foo.bar/?x=1" , False ),
218
231
(Lookup .EQUAL , {"x" : ANY }, "https://foo.bar/?x=1" , True ),
219
232
(Lookup .EQUAL , {"y" : ANY }, "https://foo.bar/?x=1" , False ),
233
+ (Lookup .EQUAL , {}, "https://foo.bar/?x=1" , False ),
234
+ (Lookup .EQUAL , {}, "https://foo.bar/" , True ),
220
235
(Lookup .EQUAL , "x=1&y=2" , "https://foo.bar/?x=1" , False ),
221
236
(Lookup .EQUAL , "y=2&x=1" , "https://foo.bar/?x=1&y=2" , True ),
222
237
(Lookup .EQUAL , "y=3&x=2&x=1" , "https://foo.bar/?x=1&x=2&y=3" , False ), # ordered
0 commit comments