Skip to content

Commit

Permalink
✅ Update tests to support Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Jul 6, 2022
1 parent ed8094e commit 4808dd7
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tests/test_tracebacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ def test_traceback_rich():

assert "typer.run(main)" in result.stderr
assert "print(name + 3)" in result.stderr
assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr

# TODO: when deprecating Python 3.6, remove second option
assert (
'TypeError: can only concatenate str (not "int") to str' in result.stderr
or "TypeError: must be str, not int" in result.stderr
)
assert "name = 'morty'" in result.stderr


Expand All @@ -30,7 +35,11 @@ def test_traceback_no_rich():

assert "typer.run(main)" in result.stderr
assert "print(name + 3)" in result.stderr
assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr
# TODO: when deprecating Python 3.6, remove second option
assert (
'TypeError: can only concatenate str (not "int") to str' in result.stderr
or "TypeError: must be str, not int" in result.stderr
)


def test_unmodified_traceback():
Expand All @@ -48,4 +57,8 @@ def test_unmodified_traceback():
)
assert "typer.main.get_command(broken_app)()" in result.stderr
assert "print(name + 3)" in result.stderr
assert 'TypeError: can only concatenate str (not "int") to str' in result.stderr
# TODO: when deprecating Python 3.6, remove second option
assert (
'TypeError: can only concatenate str (not "int") to str' in result.stderr
or "TypeError: must be str, not int" in result.stderr
)

0 comments on commit 4808dd7

Please sign in to comment.