11from __future__ import annotations
22
3+ import re
34from typing import Any , Iterator , get_args
45from unittest import mock
56from unittest .mock import call
67
78import pytest
8- import regex
99
1010from crawlee ._request import UserData
1111from crawlee ._types import HttpHeaders , HttpMethod
@@ -172,11 +172,13 @@ async def test_actor_create_request_list_from_url_additional_inputs() -> None:
172172 'http://a.com' ,
173173 'http://www.something.com/somethignelse'
174174 'http://www.something.com/somethignelse.txt' ,
175- 'http://non-english-chars-áíéåü.com'
175+ 'http://non-english-chars-áíéåü.com' ,
176+ 'http://www.port.com:1234' ,
177+ 'http://username:[email protected] ' 176178])
177179def test_url_no_commas_regex_true_positives (true_positive : str ) -> None :
178180 example_string = f'Some text { true_positive } some more text'
179- matches = list (regex .finditer (URL_NO_COMMAS_REGEX , example_string ))
181+ matches = list (re .finditer (URL_NO_COMMAS_REGEX , example_string ))
180182 assert len (matches ) == 1
181183 assert matches [0 ].group (0 ) == true_positive
182184
@@ -190,12 +192,12 @@ def test_url_no_commas_regex_true_positives(true_positive: str) -> None:
190192])
191193def test_url_no_commas_regex_false_positives (false_positive : str ) -> None :
192194 example_string = f'Some text { false_positive } some more text'
193- matches = list (regex .findall (URL_NO_COMMAS_REGEX , example_string ))
195+ matches = list (re .findall (URL_NO_COMMAS_REGEX , example_string ))
194196 assert len (matches ) == 0
195197
196198def test_url_no_commas_regex_multi_line () -> None :
197199 true_positives = ('http://www.something.com' , 'http://www.else.com' )
198200 example_string = 'Some text {} some more text \n Some new line text {} ...' .format (* true_positives )
199- matches = list (regex .finditer (URL_NO_COMMAS_REGEX , example_string ))
201+ matches = list (re .finditer (URL_NO_COMMAS_REGEX , example_string ))
200202 assert len (matches ) == 2
201203 assert {match .group (0 ) for match in matches } == set (true_positives )
0 commit comments