File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 33from typing import Union
44
55from hyperbrowser .exceptions import HyperbrowserError
6+ from hyperbrowser .type_utils import is_plain_string
67
78
89def _validate_error_message_text (message_value : str , * , field_name : str ) -> None :
9- if type (message_value ) is not str :
10+ if not is_plain_string (message_value ):
1011 raise HyperbrowserError (f"{ field_name } must be a string" )
1112 try :
1213 normalized_message = message_value .strip ()
13- if type (normalized_message ) is not str :
14+ if not is_plain_string (normalized_message ):
1415 raise TypeError (f"normalized { field_name } must be a string" )
1516 is_empty = len (normalized_message ) == 0
1617 except HyperbrowserError :
@@ -62,11 +63,11 @@ def ensure_existing_file_path(
6263 ) from exc
6364 except Exception as exc :
6465 raise HyperbrowserError ("file_path is invalid" , original_error = exc ) from exc
65- if type (normalized_path ) is not str :
66+ if not is_plain_string (normalized_path ):
6667 raise HyperbrowserError ("file_path must resolve to a string path" )
6768 try :
6869 stripped_normalized_path = normalized_path .strip ()
69- if type (stripped_normalized_path ) is not str :
70+ if not is_plain_string (stripped_normalized_path ):
7071 raise TypeError ("normalized file_path must be a string" )
7172 except HyperbrowserError :
7273 raise
You can’t perform that action at this time.
0 commit comments