563
559
final fullstop. If long, they may contain newlines to break the text.
569
Do not use the Python ``assert`` statement, either in tests or elsewhere.
570
A source test checks that it is not used. It is ok to explicitly raise
575
* It makes the behaviour vary depending on whether bzr is run with -O
576
or not, therefore giving a chance for bugs that occur in one case or
577
the other, several of which have already occurred: assertions with
578
side effects, code which can't continue unless the assertion passes,
579
cases where we should give the user a proper message rather than an
581
* It's not that much shorter than an explicit if/raise.
582
* It tends to lead to fuzzy thinking about whether the check is
583
actually needed or not, and whether it's an internal error or not
584
* It tends to cause look-before-you-leap patterns.
585
* It's unsafe if the check is needed to protect the integrity of the
587
* It tends to give poor messages since the developer can get by with
588
no explanatory text at all.
589
* We can't rely on people always running with -O in normal use, so we
590
can't use it for tests that are actually expensive.
591
* Expensive checks that help developers are better turned on from the
592
test suite or a -D flag.
593
* If used instead of ``self.assert*()`` in tests it makes them falsely pass with -O.
596
563
Documenting Changes
597
564
===================