comparison tests/test-check-code.t @ 18183:e1caaeb5a2ed

check-code: disallow defunct <> operator Added a test for that and one other python3 check in test-check-code.t.
author Augie Fackler <raf@durin42.com>
date Tue, 01 Jan 2013 13:05:22 -0600
parents c582a71457e5
children a91387a37f05
comparison
equal deleted inserted replaced
18182:e6db64abfa87 18183:e1caaeb5a2ed
108 old-style class, use class foo(object) 108 old-style class, use class foo(object)
109 ./classstyle.py:7: 109 ./classstyle.py:7:
110 > class empty(): 110 > class empty():
111 class foo() not available in Python 2.4, use class foo(object) 111 class foo() not available in Python 2.4, use class foo(object)
112 [1] 112 [1]
113 $ cat > python3-compat.py << EOF
114 > foo <> bar
115 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
116 > EOF
117 $ "$check_code" python3-compat.py
118 python3-compat.py:1:
119 > foo <> bar
120 <> operator is not available in Python 3+, use !=
121 python3-compat.py:2:
122 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
123 reduce is not available in Python 3+
124 [1]
113 125
114 $ cat > is-op.py <<EOF 126 $ cat > is-op.py <<EOF
115 > # is-operator comparing number or string literal 127 > # is-operator comparing number or string literal
116 > x = None 128 > x = None
117 > y = x is 'foo' 129 > y = x is 'foo'