##// END OF EJS Templates
coding style: fix yield used as a function
Thomas Arendsen Hein -
r13077:6b8d2ee2 default
parent child Browse files
Show More
@@ -1,95 +1,95
1 1 $ cat > correct.py <<EOF
2 2 > def toto(arg1, arg2):
3 3 > del arg2
4 4 > return (5 + 6, 9)
5 5 > EOF
6 6 $ cat > wrong.py <<EOF
7 7 > def toto( arg1, arg2):
8 8 > del(arg2)
9 9 > return ( 5+6, 9)
10 10 > EOF
11 11 $ cat > quote.py <<EOF
12 12 > # let's use quote in comments
13 13 > (''' ( 4x5 )
14 14 > but """\\''' and finally''',
15 15 > """let's fool checkpatch""", '1+2',
16 16 > '"""', 42+1, """and
17 17 > ( 4-1 ) """, "( 1+1 )\" and ")
18 18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1"
19 19 > EOF
20 20 $ cat > non-py24.py <<EOF
21 21 > # Using builtins that does not exist in Python 2.4
22 22 > if any():
23 23 > x = all()
24 24 > y = format(x)
25 25 >
26 26 > # Do not complain about our own definition
27 27 > def any(x):
28 28 > pass
29 29 > EOF
30 30 $ check_code="$TESTDIR"/../contrib/check-code.py
31 31 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py
32 32 ./wrong.py:1:
33 33 > def toto( arg1, arg2):
34 34 gratuitous whitespace in () or []
35 35 ./wrong.py:2:
36 36 > del(arg2)
37 del isn't a function
37 Python keyword is not a function
38 38 ./wrong.py:3:
39 39 > return ( 5+6, 9)
40 40 missing whitespace in expression
41 41 gratuitous whitespace in () or []
42 42 ./quote.py:5:
43 43 > '"""', 42+1, """and
44 44 missing whitespace in expression
45 45 ./non-py24.py:2:
46 46 > if any():
47 47 any/all/format not available in Python 2.4
48 48 ./non-py24.py:3:
49 49 > x = all()
50 50 any/all/format not available in Python 2.4
51 51 ./non-py24.py:4:
52 52 > y = format(x)
53 53 any/all/format not available in Python 2.4
54 54 [1]
55 55
56 56 $ cat > is-op.py <<EOF
57 57 > # is-operator comparing number or string literal
58 58 > x = None
59 59 > y = x is 'foo'
60 60 > y = x is "foo"
61 61 > y = x is 5346
62 62 > y = x is -6
63 63 > y = x is not 'foo'
64 64 > y = x is not "foo"
65 65 > y = x is not 5346
66 66 > y = x is not -6
67 67 > EOF
68 68
69 69 $ "$check_code" ./is-op.py
70 70 ./is-op.py:3:
71 71 > y = x is 'foo'
72 72 object comparison with literal
73 73 ./is-op.py:4:
74 74 > y = x is "foo"
75 75 object comparison with literal
76 76 ./is-op.py:5:
77 77 > y = x is 5346
78 78 object comparison with literal
79 79 ./is-op.py:6:
80 80 > y = x is -6
81 81 object comparison with literal
82 82 ./is-op.py:7:
83 83 > y = x is not 'foo'
84 84 object comparison with literal
85 85 ./is-op.py:8:
86 86 > y = x is not "foo"
87 87 object comparison with literal
88 88 ./is-op.py:9:
89 89 > y = x is not 5346
90 90 object comparison with literal
91 91 ./is-op.py:10:
92 92 > y = x is not -6
93 93 object comparison with literal
94 94 [1]
95 95
General Comments 0
You need to be logged in to leave comments. Login now