MCPcopy Index your code
hub / github.com/python/cpython / checkAssertLogsPerLevel

Method checkAssertLogsPerLevel

Lib/test/test_unittest/test_case.py:1850–1859  ·  view source on GitHub ↗
(self, level)

Source from the content-addressed store, hash-verified

1848 [{'name': 'foo'}, {'name': 'quux'}])
1849
1850 def checkAssertLogsPerLevel(self, level):
1851 # Check level filtering
1852 with self.assertNoStderr():
1853 with self.assertLogs(level=level) as cm:
1854 log_foo.warning("1")
1855 log_foobar.error("2")
1856 log_quux.critical("3")
1857 self.assertEqual(cm.output, ["ERROR:foo.bar:2", "CRITICAL:quux:3"])
1858 self.assertLogRecords(cm.records,
1859 [{'name': 'foo.bar'}, {'name': 'quux'}])
1860
1861 def testAssertLogsPerLevel(self):
1862 self.checkAssertLogsPerLevel(logging.ERROR)

Callers 1

Calls 7

assertNoStderrMethod · 0.95
assertLogRecordsMethod · 0.95
assertLogsMethod · 0.80
warningMethod · 0.45
errorMethod · 0.45
criticalMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected