@skip_if_not_qt4
def test_code_editor_show_line_numbers():
    def is_line_numbers_visible(ui):
        from pyface import qt
        txt_ctrl = ui.control.findChild(qt.QtGui.QPlainTextEdit)
        return txt_ctrl.line_number_widget.isVisible()

    def test_line_numbers_visibility(show=True):
        with store_exceptions_on_all_threads():
            code_model = CodeModel()
            code_view = CodeView(model=code_model,
                                 show_line_numbers=show)
            ui = code_view.edit_traits()
            nose.tools.assert_equal(is_line_numbers_visible(ui), show)
            ui.control.close()

    test_line_numbers_visibility(True)
    test_line_numbers_visibility(False)
CodeEditor should honor the `show_line_numbers` setting
dataset/ETHPy150Open enthought/traitsui/traitsui/tests/editors/test_code_editor.py/test_code_editor_show_line_numbers