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

Function test_annotated_assignment

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

Source from the content-addressed store, hash-verified

91
92
93def test_annotated_assignment() -> None:
94 source = (
95 'a: str = "Sphinx" #: comment\n'
96 'b: int = 1\n'
97 '"""string on next line"""\n'
98 'c: int #: comment\n'
99 'd = 1 # type: int\n'
100 '"""string on next line"""\n'
101 )
102 parser = Parser(source)
103 parser.parse()
104 assert parser.comments == {
105 ('', 'a'): 'comment',
106 ('', 'b'): 'string on next line',
107 ('', 'c'): 'comment',
108 ('', 'd'): 'string on next line',
109 }
110 assert parser.annotations == {
111 ('', 'a'): 'str',
112 ('', 'b'): 'int',
113 ('', 'c'): 'int',
114 ('', 'd'): 'int',
115 }
116 assert parser.definitions == {}
117
118
119def test_complex_assignment() -> 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…