MCPcopy
hub / github.com/scrapy/scrapy / test_ignore_unknown_options

Method test_ignore_unknown_options

tests/test_utils_curl.py:214–226  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

212 curl_to_request_kwargs("curl")
213
214 def test_ignore_unknown_options(self):
215 # case 1: ignore_unknown_options=True:
216 with warnings.catch_warnings(): # avoid warning when executing tests
217 warnings.simplefilter("ignore")
218 curl_command = "curl --bar --baz http://www.example.com"
219 expected_result = {"method": "GET", "url": "http://www.example.com"}
220 assert curl_to_request_kwargs(curl_command) == expected_result
221
222 # case 2: ignore_unknown_options=False (raise exception):
223 with pytest.raises(ValueError, match=r"Unrecognized options:.*--bar.*--baz"):
224 curl_to_request_kwargs(
225 "curl --bar --baz http://www.example.com", ignore_unknown_options=False
226 )
227
228 def test_must_start_with_curl_error(self):
229 with pytest.raises(ValueError, match="A curl command must start"):

Callers

nothing calls this directly

Calls 1

curl_to_request_kwargsFunction · 0.90

Tested by

no test coverage detected