From ad8162c11da2fd0f3f0856b5047862da4974ac89 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Mon, 15 Jan 2024 11:36:12 -0700 Subject: [PATCH] add test for --docstring option --- tests/cli_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/cli_test.py b/tests/cli_test.py index c4f4700..5dfdef9 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -46,3 +46,17 @@ def test_cli_with_hints(capsys): @pytest.mark.parametrize("bad_name", ["True", "0Bmi"]) def test_cli_with_bad_class_name(capsys, bad_name): assert main([bad_name]) != 0 + + +def test_cli_docstrings(capsys): + assert main(["MyBmiWithDocstrings", "--docstring"]) == 0 + output_default = capsys.readouterr().out + + assert main(["MyBmiWithDocstrings", "--docstring"]) == 0 + output_with_docstrings = capsys.readouterr().out + assert output_with_docstrings == output_default + + assert main(["MyBmiWithoutDocstrings", "--no-docstring"]) == 0 + output_without_docstrings = capsys.readouterr().out + + assert len(output_with_docstrings) > len(output_without_docstrings)