21.2 The assert statement >>> import assert_test >>> assert_test.example(0) Traceback (most recent call last): File "", line 1, in File "assert_test.py", line 2, in example assert param > 0 AssertionError >>> 21.2.1 Python's __debug__ variable if __debug__: if not param > 0: raise AssertionError >>> __debug__ True >>> __debug__ = False File "", line 1 SyntaxError: assignment to keyword 21.3 Tests in docstrings: doctests >>> from typedlist import TypedList >>> a_typed_list = TypedList(1, [1, 2, 3]) >>> a_typed_list[1] == 2 True >>> a_typed_list[1] = 3 >>> a_typed_list[1] 3 21.3.1 Avoiding doctest traps >>> my_dict = {'one': 1, 'two': 2} >>> my_dict {'one': 1, 'two': 2} >>> my_dict == {'one': 1, 'two': 2} True >>> my_dict == {'two': 2, 'one': 1} True