Skip to content

Commit

Permalink
(test - 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Dec 6, 2024
1 parent 0bf3b34 commit af1e09e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/unit_server/arghandler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,21 +564,16 @@ def test_230__argparse_catch_most__error(argument_source: str, exc: Exception) -
args,
)

def _validate(val: Any, test: bool, exc: Exception):
if test:
return val
if not isinstance(exc, argparse.ArgumentTypeError):
raise argparse.ArgumentTypeError(f"{repr(exc)} [{val}]")
def _error_it(_: Any, exc: Exception):
raise exc

for arg, _ in args.items():
print()
print(arg)
arghand.add_argument(
arg,
type=lambda x: _validate(
type=lambda x: _error_it(
x,
False, # always error
exc("it's a bad value"), # type: ignore
),
)
Expand Down

0 comments on commit af1e09e

Please sign in to comment.