python-httpretty/0004-lint.patch
zhang-liang-pengkun 89c8d1873a Fix the error in the code that causes a ValueError exception to be thrown
Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
2023-12-29 16:20:44 +08:00

122 lines
4.7 KiB
Diff

From 2314893ec5ab46513e91ab867d7b55a72968909e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Falc=C3=A3o?= <gabriel@nacaolivre.org>
Date: Sun, 4 Nov 2018 23:32:50 +0100
Subject: [PATCH] lint
---
httpretty/http.py | 2 +-
tests/functional/test_httplib2.py | 2 +-
tests/functional/test_requests.py | 14 +++++++-------
tests/functional/test_urllib2.py | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/httpretty/http.py b/httpretty/http.py
index a256905..79dac73 100644
--- a/httpretty/http.py
+++ b/httpretty/http.py
@@ -133,7 +133,7 @@ def parse_requestline(s):
ValueError: Not a Request-Line
"""
methods = '|'.join(HttpBaseClass.METHODS)
- m = re.match(r'(' + methods + ')\s+(.*)\s+HTTP/(1.[0|1])', s, re.I)
+ m = re.match(r'(' + methods + r')\s+(.*)\s+HTTP/(1.[0|1])', s, re.I)
if m:
return m.group(1).upper(), m.group(2), m.group(3)
else:
diff --git a/tests/functional/test_httplib2.py b/tests/functional/test_httplib2.py
index 3b78043..9aa6a5b 100644
--- a/tests/functional/test_httplib2.py
+++ b/tests/functional/test_httplib2.py
@@ -295,7 +295,7 @@ def test_httpretty_should_allow_registering_regexes():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
body="Found brand",
)
diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py
index e98b23f..06bdc1e 100644
--- a/tests/functional/test_requests.py
+++ b/tests/functional/test_requests.py
@@ -564,7 +564,7 @@ def test_httpretty_should_allow_registering_regexes_and_give_a_proper_match_to_t
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
body=lambda method, uri, headers: [200, headers, uri]
)
@@ -581,7 +581,7 @@ def test_httpretty_should_allow_registering_regexes():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
body="Found brand",
)
@@ -598,7 +598,7 @@ def test_httpretty_provides_easy_access_to_querystrings_with_regexes():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com/v1/(?P<endpoint>\w+)/$"),
+ re.compile(r"https://api.yipit.com/v1/(?P<endpoint>\w+)/$"),
body="Find the best daily deals"
)
@@ -617,7 +617,7 @@ def test_httpretty_allows_to_chose_if_querystring_should_be_matched():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://example.org/(?P<endpoint>\w+)/$"),
+ re.compile(r"https://example.org/(?P<endpoint>\w+)/$"),
body="Nudge, nudge, wink, wink. Know what I mean?",
match_querystring=True
)
@@ -659,7 +659,7 @@ def test_httpretty_should_allow_registering_regexes_with_streaming_responses():
HTTPretty.register_uri(
HTTPretty.POST,
- re.compile("https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
body=my_callback,
)
@@ -842,7 +842,7 @@ def test_httpretty_should_work_with_non_standard_ports():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com:1234/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com:1234/v1/deal;brand=(?P<brand_name>\w+)"),
body=lambda method, uri, headers: [200, headers, uri]
)
HTTPretty.register_uri(
@@ -901,7 +901,7 @@ def test_httpretty_should_allow_registering_regexes_with_port_and_give_a_proper_
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com:1234/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com:1234/v1/deal;brand=(?P<brand_name>\w+)"),
body=lambda method, uri, headers: [200, headers, uri]
)
diff --git a/tests/functional/test_urllib2.py b/tests/functional/test_urllib2.py
index d1b92ee..c2a1732 100644
--- a/tests/functional/test_urllib2.py
+++ b/tests/functional/test_urllib2.py
@@ -326,7 +326,7 @@ def test_httpretty_should_allow_registering_regexes():
HTTPretty.register_uri(
HTTPretty.GET,
- re.compile("https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
+ re.compile(r"https://api.yipit.com/v1/deal;brand=(?P<brand_name>\w+)"),
body="Found brand",
)
--
2.39.0.windows.2