check-code: catch format(), introduced in Python 2.6
authorMartin Geisler <mg@aragost.com>
Tue, 15 Jun 2010 09:55:59 +0200
changeset 11343 f325db39c8b9
parent 11342 aecabad8dd7a
child 11344 32a9744acf1e
check-code: catch format(), introduced in Python 2.6
contrib/check-code.py
tests/test-check-code
tests/test-check-code.out
--- a/contrib/check-code.py	Tue Jun 15 09:53:50 2010 +0200
+++ b/contrib/check-code.py	Tue Jun 15 09:55:59 2010 +0200
@@ -92,7 +92,7 @@
     (r'[\x80-\xff]', "non-ASCII character literal"),
     (r'("\')\.format\(', "str.format() not available in Python 2.4"),
     (r'^\s*with\s+', "with not available in Python 2.4"),
-    (r'(?<!def)\s+(any|all)\(', "any/all not available in Python 2.4"),
+    (r'(?<!def)\s+(any|all|format)\(', "any/all/format not available in Python 2.4"),
     (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
     (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
 #    (r'\s\s=', "gratuitous whitespace before ="),
--- a/tests/test-check-code	Tue Jun 15 09:53:50 2010 +0200
+++ b/tests/test-check-code	Tue Jun 15 09:55:59 2010 +0200
@@ -26,6 +26,7 @@
 # Using builtins that does not exist in Python 2.4
 if any():
     x = all()
+    y = format(x)
 
 # Do not complain about our own definition
 def any(x):
--- a/tests/test-check-code.out	Tue Jun 15 09:53:50 2010 +0200
+++ b/tests/test-check-code.out	Tue Jun 15 09:55:59 2010 +0200
@@ -13,7 +13,10 @@
  missing whitespace in expression
 ./non-py24.py:2:
  > if any():
- any/all not available in Python 2.4
+ any/all/format not available in Python 2.4
 ./non-py24.py:3:
  >     x = all()
- any/all not available in Python 2.4
+ any/all/format not available in Python 2.4
+./non-py24.py:4:
+ >     y = format(x)
+ any/all/format not available in Python 2.4