Please raise AssertionError rather than calling assert. assert gets optimized out when python is run with -O.