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