ModuleInformation.parse_ast_for_using would only handle using blocks with a single argument named _opts.
In cases where the argument was named differently (for example, opts because the options are needed by the block), the __using__ block would not be detected.
This change generalizes the pattern match a bit so that it accepts an array with a single argument (which is what __using__ requires), but makes no assumptions about the name of the argument.
It didn't seem worth it to add a new test for this case. I could have changed the name of the argument in Doctor.UseModule, but what's there is pretty conventional. So, in the end, I decided to leave the tests as-is. I can revisit that choice if you prefer.
ModuleInformation.parse_ast_for_using
would only handleusing
blocks with a single argument named_opts
.In cases where the argument was named differently (for example,
opts
because the options are needed by the block), the__using__
block would not be detected.This change generalizes the pattern match a bit so that it accepts an array with a single argument (which is what
__using__
requires), but makes no assumptions about the name of the argument.It didn't seem worth it to add a new test for this case. I could have changed the name of the argument in
Doctor.UseModule
, but what's there is pretty conventional. So, in the end, I decided to leave the tests as-is. I can revisit that choice if you prefer.