| 91 | |
| 92 | |
| 93 | def 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 | |
| 119 | def test_complex_assignment() -> None: |