MCPcopy
hub / github.com/Delgan/loguru / test_exception_class

Function test_exception_class

tests/test_opt.py:93–106  ·  view source on GitHub ↗
(writer)

Source from the content-addressed store, hash-verified

91
92
93def test_exception_class(writer):
94 logger.add(writer, format="{message}")
95
96 try:
97 1 / 0 # noqa: B018
98 except Exception:
99 _, exc_class, _ = sys.exc_info()
100
101 logger.opt(exception=exc_class).debug("test")
102
103 lines = writer.read().strip().splitlines()
104
105 assert lines[0] == "test"
106 assert lines[-1] == "ZeroDivisionError: division by zero"
107
108
109def test_exception_log_function(writer):

Callers

nothing calls this directly

Calls 5

addMethod · 0.80
debugMethod · 0.80
optMethod · 0.80
readMethod · 0.80
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…