diff options
author | Jared Garst <jgarst@users.noreply.github.com> | 2016-09-07 19:23:51 -0700 |
---|---|---|
committer | John Vandenberg <jayvdb@gmail.com> | 2016-09-08 09:23:51 +0700 |
commit | 434bbb06d4dc38ab09eb9405be6fc1279286f69d (patch) | |
tree | 1e50fc2048c1461e8902e2bc07dcf3a5907be1c5 | |
parent | 2f50952805a04fe73315922ae10f0d38e3c3d5dc (diff) | |
download | pyflakes-434bbb06d4dc38ab09eb9405be6fc1279286f69d.tar.gz |
Fix format string checking (#80)
format strings (PEP 498) defines a new AST node, JOINEDSTR which
contains a list of string expressions.
-rw-r--r-- | pyflakes/checker.py | 2 | ||||
-rw-r--r-- | pyflakes/test/test_other.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py index f08ba3f..caa9db5 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -937,7 +937,7 @@ class Checker(object): MATMULT = ignore # additional node types - COMPREHENSION = KEYWORD = FORMATTEDVALUE = handleChildren + COMPREHENSION = KEYWORD = FORMATTEDVALUE = JOINEDSTR = handleChildren def DICT(self, node): # Complain if there are duplicate keys with different values diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py index 90b980b..109bc66 100644 --- a/pyflakes/test/test_other.py +++ b/pyflakes/test/test_other.py @@ -1800,3 +1800,11 @@ class TestAsyncStatements(TestCase): def foo(a, b): return a @ b ''') + + @skipIf(version_info < (3, 6), 'new in Python 3.6') + def test_formatstring(self): + self.flakes(''' + hi = 'hi' + mom = 'mom' + f'{hi} {mom}' + ''') |