Skip to content

Commit

Permalink
tests: hide assert_one from traceback using __tracebackhide__
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed May 20, 2024
1 parent 6bfacc4 commit def4c03
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ def assert_unchanged(

def assert_one(seq: abc.Sequence[T]) -> T:
"""assert whether a sequence contains only one element and return it"""
__tracebackhide__ = True
assert (l := len(seq)) == 1, f"Expected one element in sequence, found {l} (sequence: {seq!r})"
return seq[0]

0 comments on commit def4c03

Please sign in to comment.