| 180 | assert args.S is False |
| 181 | |
| 182 | def test_parse_defaultgetter(self) -> None: |
| 183 | def defaultget(option): |
| 184 | if not hasattr(option, "type"): |
| 185 | return |
| 186 | if option.type is int: |
| 187 | option.default = 42 |
| 188 | elif option.type is str: |
| 189 | option.default = "world" |
| 190 | |
| 191 | parser = parseopt.Parser(processopt=defaultget, _ispytest=True) |
| 192 | parser.addoption("--this", dest="this", type=int, action="store") |
| 193 | parser.addoption("--hello", dest="hello", type=str, action="store") |
| 194 | parser.addoption("--no", dest="no", action="store_true") |
| 195 | option = parser.parse([]) |
| 196 | assert option.hello == "world" |
| 197 | assert option.this == 42 |
| 198 | assert option.no is False |
| 199 | |
| 200 | def test_drop_short_helper(self) -> None: |
| 201 | parser = argparse.ArgumentParser( |