GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — New conformance tag '# E[tag!]' to require at least one success by srittau · Pull Request #2354 · python/typing Conversation
|
|
I don't mind this, but just so you know: I generally just tried to work around this by not using int in these scenarios and using str literals instead, which don't have the promotion issues. In your specific case I might have used: I don't think that the promotion details matter for readers of the spec. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me as a tool to have, though like @davidhalter I suspect that there is a better way to address the motivating case (we should always avoid using float as part of conformance suite examples, unless those examples are explicitly about the int/float special case) -- and if that leaves us with no use case for this, then it probably doesn't make sense to add it now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * `# E[tag]`, where `tag` is an arbitrary string: must appear multiple times in a file with the same tag. | ||
| Exactly one line with this tag must raise an error. | ||
| * `# E[tag+]`: like `# E[tag]`, but errors may be raised on multiple lines. | ||
| * `# E[tag!]`: like `# E[tag]`, but at least one line must not raise an error. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should say explicitly here that zero errors also pass.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ]: | ||
| """Return the line numbers where type checkers are expected to produce an error. | ||
|
|
||
| The return value is a tuple of two dictionaries: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This docstring needs updating.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm also thinking about replacing the second tuple item with either a string literal or an enum "single", "multiple", "require-success". This would make a cleaner API and make it more obvious that these three options are basically mutually exclusive. What do you think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry I accidentally made a separate comment instead of replying here. If there are really just three supported/useful options, then I think an enum would be better than two booleans. (Better than using strings, too.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've introduced the enum, extracted the logic that makes a decision based on this enum, and simplified the logic so that it should be obvious what's going on. The output doesn't change, indicating that the logic is (still) correct.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- Introduce an `ErrorMultiplicity` enum and return it from `get_expected_errors()`. - Extract `determine_group_error()` from `diff_expected_errors()` and simplify logic. - Rerun black on `main.py`.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.