fix alltrue#1013
Conversation
There was a problem hiding this comment.
This looks OK - CI is currently broken for Enable because of an issue with ubuntu latest however.
A couple of comments:
- when we know that the argument of
allis an array of dtypebool(rather than a list or other iterable) then it might be better to use(...).all()and avoid an import at all. This will be the case in most of the tests, but not in functions likefill_equalwhere we have no idea what is being passed in. - it's probably clearer to use
np.allinstead ofallto avoid confusion with the built-inall.
Update: CI is now fixed on the main branch, so you will need to merge main to get tests to pass.
This gets CI back into a working state by: - restricting PyPDF to a version before 3.0 (this is used in testing only) - #1008 - restricting pyglet to a version < 2 - #1010 - mocking svg url requests - turning off wx tests for linux (we can't get a compatible wheel for the new ubuntu) - #1009 tracks this for the future Everything is passing: https://github.com/enthought/enable/actions/runs/4186677329 There is a warning about set-output, but I don't think it is us.
Thanks |
Actually, one thing I would like to discuss about (want to get clarified before making the final change): |
In the second case you still want to use However with a bit of a closer look at the actual code, it looks like everything can be done with |
| if not all(pattern): | ||
| self.state.line_state.line_dash = NO_DASH | ||
| return | ||
| pattern = asarray(pattern) |
There was a problem hiding this comment.
This whole section could be re-written to be much clearer in intent
| if not all(pattern): | |
| self.state.line_state.line_dash = NO_DASH | |
| return | |
| pattern = asarray(pattern) | |
| pattern = asarray(pattern) | |
| if (pattern == 0).any(): | |
| self.state.line_state.line_dash = NO_DASH | |
| return |
| desired = affine.affine_identity() | ||
| actual = gc.get_ctm() | ||
| self.assertTrue(alltrue(ravel(actual == desired))) | ||
| self.assertTrue(all(ravel(actual == desired))) |
There was a problem hiding this comment.
If you really want to clean things up, all of these self.assertTrue(all(... == ...)) can be replaced with:
from numpy.testing import assert_array_equal
...
assert_array_equal(..., ...)
eg. the above could be simply assert_array_equal(actual, desired)
|
Something seems to have gone wrong with the merge. Normal merge process for main is:
This will give you a single known-good merge commit on your working branch. It looks like you may have cherry-picked instead of merging? It looks like PR can still be merged, but it is making the review more difficult because it is hard to see what is a new change vs. what is the same as the main. One possibility is that given that there are a lot of changes needed, it may be easier just to put this PR on hold and create a new, clean PR starting from the head of main. Edit: alternatively I think if you do the steps above (in particular the |
FWIW, I've enabled the "Always suggest updating pull request branches" setting in this repository. With that in place, you should be able to simply click the "Update branch" button to merge main in (assuming that there aren't any conflicts). |
|
Yeah, I think new PR would be easier, I will start a new one |
|
I just find that when the builtin all function is applied to a multi dimensional list, it will treat list as individual objects (aka, if the list is empty, treat as False, if not, treat as True). Thus it will return True for multi-D list as long as all sublists in it are not empty. |
|
The latest updates are in issue #1015 |
Change all the numpy.alltrue to numpy.all
Fixes #991