loguru/tests/exceptions/source/ownership/assertion_from_lib.py

25 lines
629 B
Python

import sys
import _init
from somelib import assertionerror
from loguru import logger
def test(*, backtrace, colorize, diagnose):
logger.remove()
logger.add(sys.stderr, format="", colorize=colorize, backtrace=backtrace, diagnose=diagnose)
try:
a, b = 1, 2
assertionerror(a, b)
except AssertionError:
logger.exception("")
test(backtrace=True, colorize=True, diagnose=True)
test(backtrace=False, colorize=True, diagnose=True)
test(backtrace=True, colorize=True, diagnose=False)
test(backtrace=False, colorize=True, diagnose=False)
test(backtrace=False, colorize=False, diagnose=False)