Visitar URL original
`TestCase.assertLogs` example has broken indentation · Issue #95133 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250609061516/https://github.com/python/cpython/issues/95133
Skip to content

TestCase.assertLogs example has broken indentation #95133

Closed
@alexei

Description

@alexei

Documentation

The indentation in the example at TestCase.assertLogs is broken:

with self.assertLogs('foo', level='INFO') as cm:
   logging.getLogger('foo').info('first message')
   logging.getLogger('foo.bar').error('second message')
self.assertEqual(cm.output, ['INFO:foo:first message',
                             'ERROR:foo.bar:second message'])

It should be:

with self.assertLogs('foo', level='INFO') as cm:
    logging.getLogger('foo').info('first message')
    logging.getLogger('foo.bar').error('second message')
self.assertEqual(cm.output, ['INFO:foo:first message',
                             'ERROR:foo.bar:second message'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions