/ dev / clint / tests / rules / test_no_rst.py
test_no_rst.py
 1  from pathlib import Path
 2  
 3  from clint.config import Config
 4  from clint.index import SymbolIndex
 5  from clint.linter import Position, Range, lint_file
 6  from clint.rules.no_rst import NoRst
 7  
 8  
 9  def test_no_rst(index: SymbolIndex) -> None:
10      code = """
11  def bad(y: int) -> str:
12      '''
13      :param y: The parameter
14  
15      :returns: The result
16      '''
17  
18  def good(x: int) -> str:
19      '''
20      Args:
21          x: The parameter.
22  
23      Returns:
24          The result.
25      '''
26  """
27      config = Config(select={NoRst.name})
28      violations = lint_file(Path("test.py"), code, config, index)
29      assert len(violations) == 1
30      assert all(isinstance(v.rule, NoRst) for v in violations)
31      assert violations[0].range == Range(Position(2, 4))