diff options
author | Mickaël Schoentgen <contact@tiger-222.fr> | 2021-08-05 17:27:42 +0200 |
---|---|---|
committer | Mickaël Schoentgen <contact@tiger-222.fr> | 2021-08-05 17:45:24 +0200 |
commit | 9df42111917b3e72462ab8890310aefb05b445e6 (patch) | |
tree | 183a7976ecae4f63d558c7cc33cbc409b0557d74 | |
parent | 976d5cdc22f812ebe6b1b747ab0018b7fbfc712f (diff) |
Fix `DeprecationWarning: invalid sequence`
-rw-r--r-- | http_prompt/lexer.py | 4 | ||||
-rw-r--r-- | tests/test_execution.py | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/http_prompt/lexer.py b/http_prompt/lexer.py index 60b5025..af8392b 100644 --- a/http_prompt/lexer.py +++ b/http_prompt/lexer.py @@ -44,7 +44,7 @@ class HttpPromptLexer(RegexLexer): (r'(rm)(\s*)', bygroups(Keyword, Text), 'rm_option'), (r'(httpie|curl)(\s*)', bygroups(Keyword, Text), 'action'), - (words(HTTP_METHODS, prefix='(?i)', suffix='(?!\S)(\s*)'), + (words(HTTP_METHODS, prefix='(?i)', suffix=r'(?!\S)(\s*)'), bygroups(Keyword, Text), combined('redir_out', 'urlpath')), (r'(clear)(\s*)', bygroups(Keyword, Text), 'end'), @@ -123,7 +123,7 @@ class HttpPromptLexer(RegexLexer): ], 'action': [ - (words(HTTP_METHODS, prefix='(?i)', suffix='(\s*)'), + (words(HTTP_METHODS, prefix='(?i)', suffix=r'(\s*)'), bygroups(Keyword, Text), combined('redir_out', 'pipe', 'urlpath')), (r'', Text, combined('redir_out', 'pipe', 'urlpath')) diff --git a/tests/test_execution.py b/tests/test_execution.py index 14345bd..337b5b6 100644 --- a/tests/test_execution.py +++ b/tests/test_execution.py @@ -58,7 +58,8 @@ class ExecutionTestCase(TempAppDirTestCase): patcher.stop() def assert_httpie_main_called_with(self, args): - self.assertEqual(self.httpie_main.call_args[0][0], [HTTPIE_PROGRAM_NAME, *args]) + self.assertEqual(self.httpie_main.call_args[0][0], [ + HTTPIE_PROGRAM_NAME, *args]) def assert_stdout(self, expected_msg): # Append '\n' to simulate behavior of click.echo_via_pager(), @@ -190,7 +191,6 @@ class TestExecution_env(ExecutionTestCase): "Accept:text/csv\n" "'Authorization:ApiKey 1234'\n") - def test_env_non_ascii_and_write_to_file(self): filename = self.make_tempfile() @@ -687,7 +687,7 @@ class TestExecution_rm(ExecutionTestCase): def test_body_param_escaped(self): self.context.body_params['family name'] = 'Doe Doe' - execute('rm -b family\ name', self.context) + execute(r'rm -b family\ name', self.context) self.assertFalse(self.context.body_params) def test_body_json_param_escaped_colon(self): @@ -999,8 +999,8 @@ class TestMutation(ExecutionTestCase): }) def test_mixed(self): - execute(' --form name="John Doe" password=1234\ 5678 ' - 'User-Agent:HTTP\ Prompt -a \'john:1234 5678\' ' + execute(' --form name="John Doe" password=1234\\ 5678 ' + 'User-Agent:HTTP\\ Prompt -a \'john:1234 5678\' ' '"Accept:text/html" ', self.context) self.assertEqual(self.context.options, { '--form': None, @@ -1228,6 +1228,7 @@ class TestHttpBin(TempAppDirTestCase): """Send real requests to http://httpbin.org, save the responses to files, and asserts on the file content. """ + def setUp(self): super(TestHttpBin, self).setUp() |