comparison tests/test-check-code.t @ 19501:725507cd5216 stable

check-code: add a check for the next() builtin, which was new in 2.6
author Augie Fackler <raf@durin42.com>
date Thu, 25 Jul 2013 10:44:51 -0400
parents 3119dc155ac2
children 289bbb294e82
comparison
equal deleted inserted replaced
19500:a96565abbd59 19501:725507cd5216
20 $ cat > non-py24.py <<EOF 20 $ cat > non-py24.py <<EOF
21 > # Using builtins that does not exist in Python 2.4 21 > # Using builtins that does not exist in Python 2.4
22 > if any(): 22 > if any():
23 > x = all() 23 > x = all()
24 > y = format(x) 24 > y = format(x)
25 > # next(generator) is new in 2.6
26 > z = next(x)
27 > # but generator.next() is okay
28 > x.next()
29 > # and we can make our own next
30 > def next(stuff):
31 > pass
25 > 32 >
26 > # Do not complain about our own definition 33 > # Do not complain about our own definition
27 > def any(x): 34 > def any(x):
28 > pass 35 > pass
29 > 36 >
92 > x = all() 99 > x = all()
93 any/all/format not available in Python 2.4 100 any/all/format not available in Python 2.4
94 ./non-py24.py:4: 101 ./non-py24.py:4:
95 > y = format(x) 102 > y = format(x)
96 any/all/format not available in Python 2.4 103 any/all/format not available in Python 2.4
97 ./non-py24.py:11: 104 ./non-py24.py:6:
105 > z = next(x)
106 no next(foo) in Python 2.4 and 2.5, use foo.next() instead
107 ./non-py24.py:18:
98 > try: 108 > try:
99 no try/except/finally in Python 2.4 109 no try/except/finally in Python 2.4
100 ./non-py24.py:28: 110 ./non-py24.py:35:
101 > try: 111 > try:
102 no yield inside try/finally in Python 2.4 112 no yield inside try/finally in Python 2.4
103 ./non-py24.py:33: 113 ./non-py24.py:40:
104 > try: 114 > try:
105 no yield inside try/finally in Python 2.4 115 no yield inside try/finally in Python 2.4
106 ./classstyle.py:4: 116 ./classstyle.py:4:
107 > class oldstyle_class: 117 > class oldstyle_class:
108 old-style class, use class foo(object) 118 old-style class, use class foo(object)