MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_formatting_with_exception

Function test_formatting_with_exception

tests/unit/test_log_config.py:40–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39
40def test_formatting_with_exception() -> None:
41 formatter = CrawleeLogFormatter()
42 try:
43 raise ValueError('This is a test exception')
44
45 except ValueError:
46 exc_info = sys.exc_info()
47 record = get_log_record(logging.ERROR, 'Exception occurred', exc_info=exc_info)
48 formatted_message = formatter.format(record)
49
50 assert '\x1b[90m[test]\x1b[0m \x1b[31mERROR\x1b[0m Exception occurred' in formatted_message
51 assert 'ValueError: This is a test exception' in formatted_message
52
53
54def test_formatter_without_name() -> None:

Callers

nothing calls this directly

Calls 3

formatMethod · 0.95
CrawleeLogFormatterClass · 0.90
get_log_recordFunction · 0.85

Tested by

no test coverage detected