Skip to content

Commit 82eb728

Browse files
Test list parsing blank/control key-display fallback
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 2a32ed3 commit 82eb728

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_list_parsing_utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,32 @@ def test_parse_mapping_list_items_falls_back_when_key_display_returns_non_string
131131
)
132132

133133

134+
def test_parse_mapping_list_items_falls_back_when_key_display_returns_blank_string():
135+
with pytest.raises(
136+
HyperbrowserError,
137+
match="Failed to read demo object value for key '<unreadable key>' at index 0",
138+
):
139+
parse_mapping_list_items(
140+
[_ExplodingValueMapping()],
141+
item_label="demo",
142+
parse_item=lambda payload: payload,
143+
key_display=lambda key: f" {key[:0]} ",
144+
)
145+
146+
147+
def test_parse_mapping_list_items_falls_back_when_key_display_returns_control_chars():
148+
with pytest.raises(
149+
HyperbrowserError,
150+
match="Failed to read demo object value for key '<unreadable key>' at index 0",
151+
):
152+
parse_mapping_list_items(
153+
[_ExplodingValueMapping()],
154+
item_label="demo",
155+
parse_item=lambda payload: payload,
156+
key_display=lambda key: f"{key}\n\t",
157+
)
158+
159+
134160
def test_parse_mapping_list_items_wraps_parse_failures():
135161
with pytest.raises(
136162
HyperbrowserError,

0 commit comments

Comments
 (0)