32 lines
711 B
Python
32 lines
711 B
Python
from pathlib import Path
|
|
|
|
from clint.config import Config
|
|
from clint.index import SymbolIndex
|
|
from clint.linter import Position, Range, lint_file
|
|
from clint.rules.no_rst import NoRst
|
|
|
|
|
|
def test_no_rst(index: SymbolIndex) -> None:
|
|
code = """
|
|
def bad(y: int) -> str:
|
|
'''
|
|
:param y: The parameter
|
|
|
|
:returns: The result
|
|
'''
|
|
|
|
def good(x: int) -> str:
|
|
'''
|
|
Args:
|
|
x: The parameter.
|
|
|
|
Returns:
|
|
The result.
|
|
'''
|
|
"""
|
|
config = Config(select={NoRst.name})
|
|
violations = lint_file(Path("test.py"), code, config, index)
|
|
assert len(violations) == 1
|
|
assert all(isinstance(v.rule, NoRst) for v in violations)
|
|
assert violations[0].range == Range(Position(2, 4))
|