Paul1911
Paul1911

Reputation: 303

AssertNotEqual returns wrong result

i have the following function:

assertNotEqual(np.array(p.ideal_boundaries_lower()).all(),np.array(p.ideal_boundaries_upper()).all())

the two tested functions return a table with the same dimensions, however the values are slightly different (but not as slightly that it may not get catched anymore, we're talking about differences of 0.01 to 10). I know that the values are not the same, I checked that manually. However, I get an AssertionError, stating that both are the same.

What am I doing wrong?

Thanks already!

Upvotes: 0

Views: 92

Answers (1)

Ami Tavory
Ami Tavory

Reputation: 76381

It looks like you're comparing the results of np.all on each one of your arrays. The two arrays could be different, but the results of this could still be the same.

Perhaps you should change your code to

assertFalse((np.array(p.ideal_boundaries_lower()) == np.array(p.ideal_boundaries_upper())).all())

which would check that it's not true that all entries are equal.

Upvotes: 2

Related Questions