()
| 103 | |
| 104 | |
| 105 | def test_parse_nominal(): |
| 106 | # type: () -> None |
| 107 | |
| 108 | assert ScriptMetadata( |
| 109 | dependencies=tuple([parse_requirement_string("ansicolors")]) |
| 110 | ) == ScriptMetadata.parse( |
| 111 | dedent( |
| 112 | """ |
| 113 | # /// script |
| 114 | # dependencies = ["ansicolors"] |
| 115 | # /// |
| 116 | """ |
| 117 | ) |
| 118 | ) |
| 119 | |
| 120 | assert ScriptMetadata(requires_python=specifiers.SpecifierSet("~=3.8")) == ScriptMetadata.parse( |
| 121 | dedent( |
| 122 | """ |
| 123 | # /// script |
| 124 | # requires-python = "~=3.8" |
| 125 | # /// |
| 126 | """ |
| 127 | ) |
| 128 | ) |
| 129 | |
| 130 | assert ScriptMetadata( |
| 131 | dependencies=tuple([parse_requirement_string("cowsay<6")]), |
| 132 | requires_python=specifiers.SpecifierSet("==2.7.*"), |
| 133 | ) == ScriptMetadata.parse( |
| 134 | dedent( |
| 135 | """ |
| 136 | dependencies = ["before"] |
| 137 | # /// script |
| 138 | # dependencies = [ |
| 139 | # "cowsay<6", |
| 140 | # ] |
| 141 | # |
| 142 | # # Yup, 2.7. |
| 143 | # requires-python = "==2.7.*" |
| 144 | # |
| 145 | # not-a-recognized-key = 42 |
| 146 | # /// |
| 147 | dependencies = ["after"] |
| 148 | """ |
| 149 | ) |
| 150 | ) |
| 151 | |
| 152 | |
| 153 | def test_parse_invalid_embedded_start(): |
nothing calls this directly
no test coverage detected