Skip to content

Commit 50f3d01

Browse files
Test extension stringified key blank/control handling
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 7fc6fe1 commit 50f3d01

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/test_extension_utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,36 @@ def __str__(self) -> str:
202202
parse_extension_list_response_data({_BrokenStringKey(): "value"})
203203

204204

205+
def test_parse_extension_list_response_data_missing_key_handles_blank_stringified_keys():
206+
class _BlankStringKey:
207+
def __str__(self) -> str:
208+
return " "
209+
210+
with pytest.raises(
211+
HyperbrowserError,
212+
match=(
213+
"Expected 'extensions' key in response but got "
214+
"\\[<blank key>\\] keys"
215+
),
216+
):
217+
parse_extension_list_response_data({_BlankStringKey(): "value"})
218+
219+
220+
def test_parse_extension_list_response_data_missing_key_handles_control_stringified_keys():
221+
class _ControlStringKey:
222+
def __str__(self) -> str:
223+
return "\n\t"
224+
225+
with pytest.raises(
226+
HyperbrowserError,
227+
match=(
228+
"Expected 'extensions' key in response but got "
229+
"\\[\\?\\?\\] keys"
230+
),
231+
):
232+
parse_extension_list_response_data({_ControlStringKey(): "value"})
233+
234+
205235
def test_parse_extension_list_response_data_missing_key_handles_string_subclass_str_results():
206236
class _StringSubclassKey:
207237
class _RenderedKey(str):

0 commit comments

Comments
 (0)