def test_unit(capsys, contents, expected, expected_out): assert check_docstring_first(contents) == expected assert capsys.readouterr()[0] == expected_out.format(filename='<unknown>')