Merge lp:~maxb/launchpad/ignored-asserts into lp:launchpad
Proposed by
Max Bowsher
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~maxb/launchpad/ignored-asserts |
Merge into: | lp:launchpad |
Diff against target: |
99 lines (+21/-8) 5 files modified
lib/lp/soyuz/doc/initialise-from-parent.txt (+13/-0) lib/lp/translations/model/translatablemessage.py (+1/-1) lib/lp/translations/utilities/rosettastats.py (+1/-1) lib/lp/translations/utilities/translation_import.py (+2/-2) scripts/ftpmaster-tools/initialise-from-parent.py (+4/-4) |
To merge this branch: | bzr merge lp:~maxb/launchpad/ignored-asserts |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Graham Binns (community) | code | Needs Fixing | |
Review via email: mp+18889@code.launchpad.net |
Commit message
Fix assert statements which were not being tested owing to misplaced parentheses.
To post a comment you must log in.
The Python assert statement is not a function, and treating it as such - i.e.:
assert (a == b, "The things weren't equal!")
results in evaluating a 2-element tuple as a boolean, thus, it's approximately the same as 'assert True', i.e. a no-op.
Python 2.6 recognizes this flaw, and adds a SyntaxWarning to report this case. Thus, by running:
find -name \*.py -type f | xargs python2.6 -m py_compile
I've located all instances of the problem in the Launchpad source.
Here's a branch applying the requisite syntax fixes.