mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
Support attribute docstrings
This commit is contained in:
parent
0e509ddcbc
commit
4a101bbf99
2 changed files with 20 additions and 5 deletions
|
|
@ -38,6 +38,13 @@ TESTS = (
|
|||
),
|
||||
# String literals in expressions are ok.
|
||||
(b'x = "foo"\n', 0, ''),
|
||||
# Attribute docstrings are ok.
|
||||
(
|
||||
b'x = "foo"\n'
|
||||
b'"""x holds the foo"""',
|
||||
0,
|
||||
'',
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -48,7 +55,7 @@ all_tests = pytest.mark.parametrize(
|
|||
|
||||
@all_tests
|
||||
def test_unit(capsys, contents, expected, expected_out):
|
||||
assert check_docstring_first(contents) == expected
|
||||
assert check_docstring_first(contents, '<unknown>') == expected
|
||||
assert capsys.readouterr()[0] == expected_out.format(filename='<unknown>')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue