__init__
PYL-W0201 46@pytest.fixture()
47def editor(settings: _NssSettings):
48 editor = MockEditorController()
49 editor.settings = settings 50
51 yield editor
52
38@pytest.fixture()
39def editor(qtbot: QtBot, settings: _NssSettings) -> MockEditorController:
40 editor = MockEditorController()
41 editor.settings = settings 42 qtbot.addWidget(editor.input_editor)
43 yield editor
44 editor.history.clear()
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.