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

Modifying assertIs(x, False) to assertFalse(x) changes the meaning for falsey value of x #17

Open
Pierre-Sassoulas opened this issue Jul 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@Pierre-Sassoulas
Copy link

Pierre-Sassoulas commented Jul 11, 2022

Hello, and thank you for your work on teyit.

In the following case:

-       self.assertIs(inferred.value, False)
+       self.assertFalse(inferred.value)

If inferred.value is equal to [] or {} for example, the code does not do what it was doing before. (The same problem also apply to assertIs(x, True) to assertTrue(x)

import unittest


class TeyitTest(unittest.TestCase):

    def test_teyit(self):
        self.assertFalse(False)
        self.assertFalse([])
        self.assertIs(False, False)
        self.assertIs([], False)
        self.assertFalse(False)
        self.assertFalse([])
        self.assertIs(False, False)
>       self.assertIs([], False)
E       AssertionError: [] is not False

Context: Trying to add teyit to astroid pre-commit in pylint-dev/astroid#1703

@isidentical
Copy link
Owner

Thanks for noticing this!

@isidentical isidentical added the bug Something isn't working label Jul 11, 2022
@nega0
Copy link

nega0 commented Aug 16, 2023

Any movement on this? With teyit being recommend in the Python 3.12 "What's New", it would be nice to see this addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants