summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Vandenberg <jayvdb@gmail.com>2015-11-08 15:03:31 +1100
committerJohn Vandenberg <jayvdb@gmail.com>2015-11-08 15:29:27 +1100
commit9a4d45c12e86cbb9effd749bd13ba48927063c23 (patch)
treebf129025e50fd373e3e0f0582be4374de53b3544
parent69a715dff7243eda61f0bf5f16b8a37afb5b7ac6 (diff)
downloadpyflakes-9a4d45c12e86cbb9effd749bd13ba48927063c23.tar.gz
PEP 498 f-strings support
PEP 498 f-strings cause pyflakes to crash with AttributeError: 'Checker' object has no attribute 'FORMATTEDVALUE'
-rw-r--r--pyflakes/checker.py2
-rw-r--r--pyflakes/test/test_other.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 17e7b66..80f26ee 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -675,7 +675,7 @@ class Checker(object):
EQ = NOTEQ = LT = LTE = GT = GTE = IS = ISNOT = IN = NOTIN = ignore
# additional node types
- COMPREHENSION = KEYWORD = handleChildren
+ COMPREHENSION = KEYWORD = FORMATTEDVALUE = handleChildren
def GLOBAL(self, node):
"""
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 384c4b3..3167a1d 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -989,6 +989,14 @@ class TestUnusedAssignment(TestCase):
"""Do not crash on lone "return"."""
self.flakes('return 2')
+ @skipIf(version_info < (3, 6), 'new in Python 3.6')
+ def test_f_string(self):
+ """Test PEP 498 f-strings are treated as a usage."""
+ self.flakes('''
+ baz = 0
+ print(f'\x7b4*baz\N{RIGHT CURLY BRACKET}')
+ ''')
+
class TestAsyncStatements(TestCase):