tests/test-check-code.t
changeset 20688 a61ed1c2d7a7
parent 20005 22154ec6fb8b
child 21097 e8ef59b351c3
equal deleted inserted replaced
20687:7d4d04299927 20688:a61ed1c2d7a7
   121    class foo() not available in Python 2.4, use class foo(object)
   121    class foo() not available in Python 2.4, use class foo(object)
   122   [1]
   122   [1]
   123   $ cat > python3-compat.py << EOF
   123   $ cat > python3-compat.py << EOF
   124   > foo <> bar
   124   > foo <> bar
   125   > reduce(lambda a, b: a + b, [1, 2, 3, 4])
   125   > reduce(lambda a, b: a + b, [1, 2, 3, 4])
       
   126   > dict(key=value)
   126   > EOF
   127   > EOF
   127   $ "$check_code" python3-compat.py
   128   $ "$check_code" python3-compat.py
   128   python3-compat.py:1:
   129   python3-compat.py:1:
   129    > foo <> bar
   130    > foo <> bar
   130    <> operator is not available in Python 3+, use !=
   131    <> operator is not available in Python 3+, use !=
   131   python3-compat.py:2:
   132   python3-compat.py:2:
   132    > reduce(lambda a, b: a + b, [1, 2, 3, 4])
   133    > reduce(lambda a, b: a + b, [1, 2, 3, 4])
   133    reduce is not available in Python 3+
   134    reduce is not available in Python 3+
       
   135   python3-compat.py:3:
       
   136    > dict(key=value)
       
   137    dict() is different in Py2 and 3 and is slower than {}
   134   [1]
   138   [1]
   135 
   139 
   136   $ cat > is-op.py <<EOF
   140   $ cat > is-op.py <<EOF
   137   > # is-operator comparing number or string literal
   141   > # is-operator comparing number or string literal
   138   > x = None
   142   > x = None