Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "The truth value of an array with more than one element is ambiguous" #1685

Merged
merged 4 commits into from
Aug 3, 2019
Merged

Conversation

MrQubo
Copy link
Contributor

@MrQubo MrQubo commented Jul 24, 2019

Fixes "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

…ous"

Fixes "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"
@jonmmease
Copy link
Contributor

Hi @MrQubo, thanks a lot for the contribution!

Is this for this situation where subplot_titles is a numpy array of strings? If so, could you also add a test to packages/python/plotly/plotly/tests/test_core/test_subplots/test_make_subplots.py. You can just copy one of the existing tests that supplies subplot_titles with a list/tuple of string and change that to a numpy array. Thanks!

@MrQubo
Copy link
Contributor Author

MrQubo commented Jul 25, 2019

Thanks for the warming welcome @jonmmease.

I've added test for numpy array as well as tests for ordinary python array and an empty array.

@MrQubo
Copy link
Contributor Author

MrQubo commented Jul 25, 2019

I've got bunch of deprecation warning messages when running the tests. Seems like tests need to be updated for version 4.

@MrQubo
Copy link
Contributor Author

MrQubo commented Jul 25, 2019

I don't know why CircleCi fails. import numpy is present for example in test_orca/test_image_renderers.py.

Copy link
Contributor

@jonmmease jonmmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MrQubo! Once the new numpy test is moved and numpy test dependency changes are reverted (See inline comments) this will be good to go.

@@ -1542,6 +1544,35 @@ def test_subplot_titles_insets(self):
)
self.assertEqual(fig, expected)

def test_subplot_titles_array(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this test is testing subplot titles as a tuple. If that's what you're intending, lets name this test_subplot_titles_tuple.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All current tests are using tuples as subplot_titles argument. I thought it would be a good idea to add a test which checks if it works the same with python array.

packages/python/plotly/tox.ini Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
@jonmmease
Copy link
Contributor

Looks good. Thanks again @MrQubo!

@jonmmease jonmmease merged commit bd8d374 into plotly:master Aug 3, 2019
@jonmmease jonmmease added this to the v4.1.0 milestone Aug 3, 2019
@MrQubo MrQubo deleted the patch-1 branch August 4, 2019 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants