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

Problem with replacing assertEquals() containing a bool expression #50

Open
dex6 opened this issue Feb 5, 2024 · 0 comments
Open

Problem with replacing assertEquals() containing a bool expression #50

dex6 opened this issue Feb 5, 2024 · 0 comments

Comments

@dex6
Copy link

dex6 commented Feb 5, 2024

Thank you for a tool that saves me from converting 500+ asserts manually.

However, it failed on a few, one of them being:
self.assertEqual(xmap.area_is_free(b, e), used == 0)

which got converted to
assert xmap.area_is_free(b, e) == used == 0

but this is not an equivalent code, cause now area_is_free() result (which is False in my particular test case) is compared directly with used value (42 in my case), making the test fail instead of passing as old version did.

It should be:
assert xmap.area_is_free(b, e) == (used == 0)

Note: I didn't checked, but same problem probably affects assertNotEqual method, and also applies to other operators like !=, >, <=, etc instead of just ==.

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

No branches or pull requests

1 participant