pytest.approx doesn't support comparison between arrays and scalars #3312
Labels
status: help wanted
developers would like help from experts on this topic
type: enhancement
new feature or API change, should be merged into features branch
type: proposal
proposal for a new feature, often to gather opinions or design the API around the new feature
Sometimes we want to assert that all elements from an array are approximately equal to a single value, so this code comes naturally to mind:
the problem is that
pytest.approx
doesn't support this (the workaround is to create a second array with the same shape and filled with the scalar).Here is a test case:
here are the outputs:
This is
pip list
, including pytest version:The text was updated successfully, but these errors were encountered: