Mercurial > public > mercurial-scm > hg
diff tests/test-check-code.t @ 14763:b071cd58af50 stable
check-code: fix class style checking (with tests)
- old-style classes were only checked for one-letter class names
- add check for new-style classes with empty parent class, because
this is not available in Python 2.4
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 29 Jun 2011 13:45:51 +0200 |
parents | 6b8d2ee24ce2 |
children | aeeb2afcdc25 |
line wrap: on
line diff
--- a/tests/test-check-code.t Wed Jun 29 00:19:27 2011 +0200 +++ b/tests/test-check-code.t Wed Jun 29 13:45:51 2011 +0200 @@ -27,8 +27,21 @@ > def any(x): > pass > EOF + $ cat > classstyle.py <<EOF + > class newstyle_class(object): + > pass + > + > class oldstyle_class: + > pass + > + > class empty(): + > pass + > + > no_class = 1: + > pass + > EOF $ check_code="$TESTDIR"/../contrib/check-code.py - $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py + $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py ./wrong.py:1: > def toto( arg1, arg2): gratuitous whitespace in () or [] @@ -51,6 +64,12 @@ ./non-py24.py:4: > y = format(x) any/all/format not available in Python 2.4 + ./classstyle.py:4: + > class oldstyle_class: + old-style class, use class foo(object) + ./classstyle.py:7: + > class empty(): + class foo() not available in Python 2.4, use class foo(object) [1] $ cat > is-op.py <<EOF