Fix argument types in examples and tests#28764
Conversation
|
|
||
| with pytest.raises(TypeError, match="multiple values for argument 'rect'"): | ||
| fig.add_axes([0, 0, 1, 1], rect=[0, 0, 1, 1]) | ||
| fig.add_axes((0, 0, 1, 1), rect=[0, 0, 1, 1]) |
There was a problem hiding this comment.
rect should also be a tuple, though I'm surprised you don't get a type error for invalid parameters here (though that's on purpose and should be ignored.)
There was a problem hiding this comment.
This is because I identify one type of error and then do regex-based search and replace for that on all files.
|
Will sort the comments out and over time find and fix more if this type when bored. |
|
I take the liberty of putting this one in draft since it seems to be contingent on @oscargus' boredom levels. |
|
I am also in favor of these changes, of course lists work, but don't allow you to specify length, which is why the type hints are Tuple... since the number of elements is super important for these cases |
4122887 to
db4e67c
Compare
|
I took the liberty to rebase and fix the commented issues. |
PR summary
Not sure if this is wanted, so I have only done this for a few methods as a discussion opener.
Background: I got a typing error in my editor when looking at an example.
It seems to me that if we type something as a tuple (and not as a tuple or a list), it makes sense to provide a tuple in all examples (and tests as I did some search-and-replace). But then I do not know the background to typing it as a tuple only.
PR checklist