Skip to content

Commit 4fe4822

Browse files
authored
✅ Refactor tests for compatibility with Click 8.2 (#1230)
1 parent ca2559a commit 4fe4822

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

tests/test_others.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def main(arg1, arg2: int, arg3: "int", arg4: bool = False, arg5: "bool" = False)
243243

244244
result = runner.invoke(app, ["Hello", "2", "invalid"])
245245

246-
assert "Invalid value for 'ARG3': 'invalid' is not a valid integer" in result.stdout
246+
assert "Invalid value for 'ARG3': 'invalid' is not a valid integer" in result.output
247247
result = runner.invoke(app, ["Hello", "2", "3", "--arg4", "--arg5"])
248248
assert (
249249
"arg1: <class 'str'> Hello\narg2: <class 'int'> 2\narg3: <class 'int'> 3\narg4: <class 'bool'> True\narg5: <class 'bool'> True\n"

tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_call_no_arg_no_rich():
3131
typer.core.rich = None
3232
result = runner.invoke(app)
3333
assert result.exit_code != 0
34-
assert "Error: Missing argument 'NAME'" in result.stdout
34+
assert "Error: Missing argument 'NAME'" in result.output
3535
typer.core.rich = rich
3636

3737

tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_call_no_arg_no_rich():
3131
typer.core.rich = None
3232
result = runner.invoke(app)
3333
assert result.exit_code != 0
34-
assert "Error: Missing argument 'NAME'" in result.stdout
34+
assert "Error: Missing argument 'NAME'" in result.output
3535
typer.core.rich = rich
3636

3737

tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_call_no_arg_no_rich():
3131
typer.core.rich = None
3232
result = runner.invoke(app)
3333
assert result.exit_code != 0
34-
assert "Error: Missing argument 'NAME'" in result.stdout
34+
assert "Error: Missing argument 'NAME'" in result.output
3535
typer.core.rich = rich
3636

3737

tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_defaults():
3030
def test_invalid_args():
3131
result = runner.invoke(app, ["Draco", "Hagrid"])
3232
assert result.exit_code != 0
33-
assert "Argument 'names' takes 3 values" in result.stdout
33+
assert "Argument 'names' takes 3 values" in result.output
3434

3535

3636
def test_valid_args():

tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_defaults():
3232
def test_invalid_args():
3333
result = runner.invoke(app, ["Draco", "Hagrid"])
3434
assert result.exit_code != 0
35-
assert "Argument 'names' takes 3 values" in result.stdout
35+
assert "Argument 'names' takes 3 values" in result.output
3636

3737

3838
def test_valid_args():

tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_invalid():
3030
assert result.exit_code != 0
3131
assert (
3232
"Invalid value for 'BIRTH:[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]':"
33-
in result.stdout
33+
in result.output
3434
)
3535
assert "'july-19-1989' does not match the formats" in result.output
3636
assert "%Y-%m-%d" in result.output

tests/test_tutorial/test_terminating/test_tutorial003.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def test_root_no_rich():
3838
typer.core.rich = None
3939
result = runner.invoke(app, ["root"])
4040
assert result.exit_code == 1
41-
assert "The root user is reserved" in result.stdout
42-
assert "Aborted!" in result.stdout
41+
assert "The root user is reserved" in result.output
42+
assert "Aborted!" in result.output
4343
typer.core.rich = rich
4444

4545

tests/test_tutorial/test_using_click/test_tutorial003.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def test_cli():
1212
result = runner.invoke(mod.typer_click_object, [])
13-
assert "Missing command" in result.stdout
13+
assert "Missing command" in result.output
1414

1515

1616
def test_help():

tests/test_tutorial/test_using_click/test_tutorial004.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
def test_cli():
1212
result = runner.invoke(mod.cli, [])
13-
assert "Usage" in result.stdout
14-
assert "dropdb" in result.stdout
15-
assert "sub" in result.stdout
13+
assert "Usage" in result.output
14+
assert "dropdb" in result.output
15+
assert "sub" in result.output
1616

1717

1818
def test_typer():

0 commit comments

Comments
 (0)