-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the types in --copy and --entrypoint (#500)
* fix the types in --copy and --entrypoint Both of these options use the class OptionEatAll. By default, this class will output a string type, but that would result in a string that looked like a tuple. For example, it is possible to use `ast.literal_eval(value)` on the value to convert it back to a tuple. To fix this, this commit sets the type for --copy and --entrypoint to `tuple` and the subsequent code expects the values for --copy and --entrypoint to be tuples. This commit also adds a type hint to an OptionsEatAll internal to help with debugging. * expand issue 498 tests for --copy and --entrypoint * change assertions to raise click.ClickException This formats the error messages better (and with less clutter). This commit also adds a note to contact the devs in the case of errors that users cannot fix (errors in the implementation...). * raise an error if OptionEatAll is used as a str type The fundamental issue leading to #498 was that the values in OptionEatAll were being coerced to a string type if no type was specified in OptionEatAll. This made a tuple `('foo',)` into a string `'("foo",)'`. This commit raises an error if OptionEatAll is used as a string. Indeed, the 'eat-all' nature of this option suggests that there are multiple options, which suggests the type should be a list or tuple. This commit also adds a test for this.
- Loading branch information
Showing
2 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters