summaryrefslogtreecommitdiff
path: root/pyflakes/test/test_other.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/test/test_other.py')
-rw-r--r--pyflakes/test/test_other.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 1891c15..0ac96a3 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -1633,6 +1633,40 @@ class TestUnusedAssignment(TestCase):
baz += bar()
''')
+ def test_assert_without_message(self):
+ """An assert without a message is not an error."""
+ self.flakes('''
+ a = 1
+ assert a
+ ''')
+
+ def test_assert_with_message(self):
+ """An assert with a message is not an error."""
+ self.flakes('''
+ a = 1
+ assert a, 'x'
+ ''')
+
+ def test_assert_tuple(self):
+ """An assert of a non-empty tuple is always True."""
+ self.flakes('''
+ assert (False, 'x')
+ assert (False, )
+ ''', m.AssertTuple, m.AssertTuple)
+
+ def test_assert_tuple_empty(self):
+ """An assert of an empty tuple is always False."""
+ self.flakes('''
+ assert ()
+ ''')
+
+ def test_assert_static(self):
+ """An assert of a static value is not an error."""
+ self.flakes('''
+ assert True
+ assert 1
+ ''')
+
@skipIf(version_info < (3, 3), 'new in Python 3.3')
def test_yieldFromUndefined(self):
"""