Mercurial > hg
annotate tests/test-check-code.t @ 16541:bb3334806ace stable
tests: quote dummyssh in a way that works on windows too
Don't depend on $environmentvariableexpansion and 'quote' handling in system()
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 28 Apr 2012 02:00:04 +0200 |
parents | 7917a104a285 |
children | 72803c8edaa4 |
rev | line source |
---|---|
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
1 $ cat > correct.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
2 > def toto(arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
3 > del arg2 |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
4 > return (5 + 6, 9) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
5 > EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
6 $ cat > wrong.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
7 > def toto( arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
8 > del(arg2) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
9 > return ( 5+6, 9) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
10 > EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
11 $ cat > quote.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
12 > # let's use quote in comments |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
13 > (''' ( 4x5 ) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
14 > but """\\''' and finally''', |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
15 > """let's fool checkpatch""", '1+2', |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
16 > '"""', 42+1, """and |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
17 > ( 4-1 ) """, "( 1+1 )\" and ") |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1" |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
19 > EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
20 $ cat > non-py24.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
21 > # Using builtins that does not exist in Python 2.4 |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
22 > if any(): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
23 > x = all() |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
24 > y = format(x) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
25 > |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
26 > # Do not complain about our own definition |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
27 > def any(x): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
28 > pass |
15285
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
29 > |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
30 > # try/except/finally block does not exist in Python 2.4 |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
31 > try: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
32 > pass |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
33 > except StandardError, inst: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
34 > pass |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
35 > finally: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
36 > pass |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
37 > |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
38 > # nested try/finally+try/except is allowed |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
39 > try: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
40 > try: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
41 > pass |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
42 > except StandardError, inst: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
43 > pass |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
44 > finally: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
45 > pass |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
46 > EOF |
14763
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
47 $ cat > classstyle.py <<EOF |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
48 > class newstyle_class(object): |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
49 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
50 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
51 > class oldstyle_class: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
52 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
53 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
54 > class empty(): |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
55 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
56 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
57 > no_class = 1: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
58 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
59 > EOF |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
60 $ check_code="$TESTDIR"/../contrib/check-code.py |
14763
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
61 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
62 ./wrong.py:1: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
63 > def toto( arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
64 gratuitous whitespace in () or [] |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
65 ./wrong.py:2: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
66 > del(arg2) |
13077
6b8d2ee24ce2
coding style: fix yield used as a function
Thomas Arendsen Hein <thomas@jtah.de>
parents:
13026
diff
changeset
|
67 Python keyword is not a function |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
68 ./wrong.py:3: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
69 > return ( 5+6, 9) |
15281
aeeb2afcdc25
check-code: support multiline matches like try/except/finally
Matt Mackall <mpm@selenic.com>
parents:
14763
diff
changeset
|
70 gratuitous whitespace in () or [] |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
71 missing whitespace in expression |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
72 ./quote.py:5: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
73 > '"""', 42+1, """and |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
74 missing whitespace in expression |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
75 ./non-py24.py:2: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
76 > if any(): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
77 any/all/format not available in Python 2.4 |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
78 ./non-py24.py:3: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
79 > x = all() |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
80 any/all/format not available in Python 2.4 |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
81 ./non-py24.py:4: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
82 > y = format(x) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
83 any/all/format not available in Python 2.4 |
15285
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
84 ./non-py24.py:11: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
85 > try: |
42e71f5852ee
test-check-code.t: test matching try/except/finally introduced in aeeb2afcdc25
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15281
diff
changeset
|
86 no try/except/finally in Py2.4 |
14763
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
87 ./classstyle.py:4: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
88 > class oldstyle_class: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
89 old-style class, use class foo(object) |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
90 ./classstyle.py:7: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
91 > class empty(): |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
92 class foo() not available in Python 2.4, use class foo(object) |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
93 [1] |
13026
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
94 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
95 $ cat > is-op.py <<EOF |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
96 > # is-operator comparing number or string literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
97 > x = None |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
98 > y = x is 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
99 > y = x is "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
100 > y = x is 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
101 > y = x is -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
102 > y = x is not 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
103 > y = x is not "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
104 > y = x is not 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
105 > y = x is not -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
106 > EOF |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
107 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
108 $ "$check_code" ./is-op.py |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
109 ./is-op.py:3: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
110 > y = x is 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
111 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
112 ./is-op.py:4: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
113 > y = x is "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
114 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
115 ./is-op.py:5: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
116 > y = x is 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
117 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
118 ./is-op.py:6: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
119 > y = x is -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
120 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
121 ./is-op.py:7: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
122 > y = x is not 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
123 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
124 ./is-op.py:8: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
125 > y = x is not "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
126 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
127 ./is-op.py:9: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
128 > y = x is not 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
129 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
130 ./is-op.py:10: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
131 > y = x is not -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
132 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
133 [1] |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
134 |
15502
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
135 $ cat > warning.py <<EOF |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
136 > except: |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
137 > EOF |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
138 $ "$check_code" warning.py --warning --nolineno |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
139 warning.py:0: |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
140 > except: |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
141 warning: naked except clause |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
142 [1] |