Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b48d296

Browse files
committed
better error msg
1 parent dd4c4ed commit b48d296

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

IPython/utils/tests/test_tokenutil.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ def expect_token(expected: str, cell: str, cursor_pos: int | None = None) -> Non
1515
Assert that the token at the cursor position is `expected`.
1616
"""
1717
if cursor_pos is None:
18-
assert cell.count("|") == 1, "Cursor position not specified and no | found"
18+
assert (
19+
cursor_count := cell.count("|")
20+
) == 1, (
21+
f"Cursor position not specified and found {cursor_count} instance(s) of '|'"
22+
)
1923
cursor_pos = cell.index("|")
2024
cell = cell.replace("|", "")
2125
token = token_at_cursor(cell, cursor_pos)

0 commit comments

Comments
 (0)