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

CI/TST: fix tests for changed numpy error from creating ragged array #1627

Merged
merged 2 commits into from Nov 24, 2022

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche
Copy link
Member Author

jorisvandenbossche commented Nov 24, 2022

Ragged array creation will now always raise a ValueError unless
dtype=object is passed. This includes very deeply nested
sequences. (numpy/numpy#22004)

>>> np.__version__
'1.23.4'
>>> np.array([[1], [2, 3]])
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple 
  of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do 
  this, you must specify 'dtype=object' when creating the ndarray.
array([list([1]), list([2, 3])], dtype=object)

vs

>>> np.__version__
'1.24.0rc1'
>>> np.array([[1], [2, 3]])
...
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous 
shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

Now this raises an error. Before, we would also get some (other) error in a later stage because of the object dtype array (when expecting a numerical array of coordinates)

@coveralls
Copy link

coveralls commented Nov 24, 2022

Pull Request Test Coverage Report for Build 3543533694

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 84.754%

Totals Coverage Status
Change from base Build 3543492816: 0%
Covered Lines: 2218
Relevant Lines: 2617

💛 - Coveralls

Copy link
Member

@mwtoews mwtoews left a comment

Choose a reason for hiding this comment

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

Looks good!

@jorisvandenbossche jorisvandenbossche merged commit 108f180 into shapely:main Nov 24, 2022
@jorisvandenbossche jorisvandenbossche deleted the ci-fix-numpy-main branch November 24, 2022 23:46
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

3 participants