MCPcopy
hub / github.com/sphinx-doc/sphinx / test_comment_picker_basic

Function test_comment_picker_basic

tests/test_pycode/test_pycode_parser.py:9–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8
9def test_comment_picker_basic() -> None:
10 source = (
11 'a = 1 + 1 #: assignment\n'
12 'b = 1 +\\\n 1 #: assignment including a CR\n'
13 'c = (1 +\n 1) #: tuple \n'
14 'd = {1, \n 1} #: set\n'
15 'e = [1, \n 1] #: list #: additional comment\n'
16 'f = "abc"\n'
17 '#: string; comment on next line (ignored)\n'
18 'g = 1.0\n'
19 '"""float; string on next line"""\n'
20 )
21 parser = Parser(source)
22 parser.parse()
23 assert parser.comments == {
24 ('', 'a'): 'assignment',
25 ('', 'b'): 'assignment including a CR',
26 ('', 'c'): 'tuple ',
27 ('', 'd'): ' set',
28 ('', 'e'): 'list #: additional comment',
29 ('', 'g'): 'float; string on next line',
30 }
31
32
33def test_comment_picker_location() -> None:

Callers

nothing calls this directly

Calls 2

parseMethod · 0.95
ParserClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…