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

Function test_duplicate_key_is_suppressed

tests/unit/_utils/test_log.py:20–26  ·  view source on GitHub ↗
(caplog: pytest.LogCaptureFixture)

Source from the content-addressed store, hash-verified

18
19
20def test_duplicate_key_is_suppressed(caplog: pytest.LogCaptureFixture) -> None:
21 logger = logging.getLogger('crawlee.tests.log_dedup_duplicate')
22 logger_once = LoggerOnce(logger)
23 with caplog.at_level(logging.INFO, logger=logger.name):
24 logger_once.log('first', key='k1')
25 logger_once.log('second', key='k1')
26 assert [r.getMessage() for r in caplog.records] == ['first']
27
28
29def test_distinct_keys_each_log(caplog: pytest.LogCaptureFixture) -> None:

Callers

nothing calls this directly

Calls 2

logMethod · 0.95
LoggerOnceClass · 0.90

Tested by

no test coverage detected