Skip to content

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

Description

@dex6

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 ==.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions