$41 GRAYBYTE WORDPRESS FILE MANAGER $66

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.217.149
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/pyflakes/test/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/pyflakes/test//test_is_literal.py
from pyflakes.messages import IsLiteral
from pyflakes.test.harness import TestCase


class Test(TestCase):
    def test_is_str(self):
        self.flakes("""
        x = 'foo'
        if x is 'foo':
            pass
        """, IsLiteral)

    def test_is_bytes(self):
        self.flakes("""
        x = b'foo'
        if x is b'foo':
            pass
        """, IsLiteral)

    def test_is_unicode(self):
        self.flakes("""
        x = u'foo'
        if x is u'foo':
            pass
        """, IsLiteral)

    def test_is_int(self):
        self.flakes("""
        x = 10
        if x is 10:
            pass
        """, IsLiteral)

    def test_is_true(self):
        self.flakes("""
        x = True
        if x is True:
            pass
        """)

    def test_is_false(self):
        self.flakes("""
        x = False
        if x is False:
            pass
        """)

    def test_is_not_str(self):
        self.flakes("""
        x = 'foo'
        if x is not 'foo':
            pass
        """, IsLiteral)

    def test_is_not_bytes(self):
        self.flakes("""
        x = b'foo'
        if x is not b'foo':
            pass
        """, IsLiteral)

    def test_is_not_unicode(self):
        self.flakes("""
        x = u'foo'
        if x is not u'foo':
            pass
        """, IsLiteral)

    def test_is_not_int(self):
        self.flakes("""
        x = 10
        if x is not 10:
            pass
        """, IsLiteral)

    def test_is_not_true(self):
        self.flakes("""
        x = True
        if x is not True:
            pass
        """)

    def test_is_not_false(self):
        self.flakes("""
        x = False
        if x is not False:
            pass
        """)

    def test_left_is_str(self):
        self.flakes("""
        x = 'foo'
        if 'foo' is x:
            pass
        """, IsLiteral)

    def test_left_is_bytes(self):
        self.flakes("""
        x = b'foo'
        if b'foo' is x:
            pass
        """, IsLiteral)

    def test_left_is_unicode(self):
        self.flakes("""
        x = u'foo'
        if u'foo' is x:
            pass
        """, IsLiteral)

    def test_left_is_int(self):
        self.flakes("""
        x = 10
        if 10 is x:
            pass
        """, IsLiteral)

    def test_left_is_true(self):
        self.flakes("""
        x = True
        if True is x:
            pass
        """)

    def test_left_is_false(self):
        self.flakes("""
        x = False
        if False is x:
            pass
        """)

    def test_left_is_not_str(self):
        self.flakes("""
        x = 'foo'
        if 'foo' is not x:
            pass
        """, IsLiteral)

    def test_left_is_not_bytes(self):
        self.flakes("""
        x = b'foo'
        if b'foo' is not x:
            pass
        """, IsLiteral)

    def test_left_is_not_unicode(self):
        self.flakes("""
        x = u'foo'
        if u'foo' is not x:
            pass
        """, IsLiteral)

    def test_left_is_not_int(self):
        self.flakes("""
        x = 10
        if 10 is not x:
            pass
        """, IsLiteral)

    def test_left_is_not_true(self):
        self.flakes("""
        x = True
        if True is not x:
            pass
        """)

    def test_left_is_not_false(self):
        self.flakes("""
        x = False
        if False is not x:
            pass
        """)

    def test_chained_operators_is_true(self):
        self.flakes("""
        x = 5
        if x is True < 4:
            pass
        """)

    def test_chained_operators_is_str(self):
        self.flakes("""
        x = 5
        if x is 'foo' < 4:
            pass
        """, IsLiteral)

    def test_chained_operators_is_true_end(self):
        self.flakes("""
        x = 5
        if 4 < x is True:
            pass
        """)

    def test_chained_operators_is_str_end(self):
        self.flakes("""
        x = 5
        if 4 < x is 'foo':
            pass
        """, IsLiteral)

    def test_is_tuple_constant(self):
        self.flakes('''\
            x = 5
            if x is ():
                pass
        ''', IsLiteral)

    def test_is_tuple_constant_containing_constants(self):
        self.flakes('''\
            x = 5
            if x is (1, '2', True, (1.5, ())):
                pass
        ''', IsLiteral)

    def test_is_tuple_containing_variables_ok(self):
        # a bit nonsensical, but does not trigger a SyntaxWarning
        self.flakes('''\
            x = 5
            if x is (x,):
                pass
        ''')


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
11 Feb 2026 9.30 AM
root / root
0755
__pycache__
--
11 Feb 2026 9.30 AM
root / root
0755
__init__.py
0 KB
20 Jan 2026 1.01 PM
root / root
0644
harness.py
0.98 KB
20 Jan 2026 1.01 PM
root / root
0644
test_api.py
26.273 KB
20 Jan 2026 1.01 PM
root / root
0644
test_builtin.py
0.568 KB
20 Jan 2026 1.01 PM
root / root
0644
test_checker.py
5.781 KB
20 Jan 2026 1.01 PM
root / root
0644
test_code_segment.py
4.391 KB
20 Jan 2026 1.01 PM
root / root
0644
test_dict.py
5.147 KB
20 Jan 2026 1.01 PM
root / root
0644
test_doctests.py
12.555 KB
20 Jan 2026 1.01 PM
root / root
0644
test_imports.py
32.913 KB
20 Jan 2026 1.01 PM
root / root
0644
test_is_literal.py
4.466 KB
20 Jan 2026 1.01 PM
root / root
0644
test_match.py
2.048 KB
20 Jan 2026 1.01 PM
root / root
0644
test_other.py
50.479 KB
20 Jan 2026 1.01 PM
root / root
0644
test_type_annotations.py
19.825 KB
20 Jan 2026 1.01 PM
root / root
0644
test_undefined_names.py
23.013 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF