Here are the examples of the python api editxt.textcommand.sys taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: editxt Source File: test_textcommand.py
def test_CommandBar_message():
from editxt.editor import Editor
def test(c):
m = Mocker()
window = m.mock()
commander = m.mock(CommandManager)
sys_exc_info = m.replace(mod.sys, "exc_info")
format_exc = m.replace(mod.traceback, "format_exception")
bar = mod.CommandBar(window, commander)
editor = window.current_editor >> m.mock(Editor)
kw = {}
if c.exc_info is not None:
kw["exc_info"] = c.exc_info
exc_info = sys_exc_info() >> ("<type>", "<exc>", "<tb>")
format_exc(*exc_info) >> ["Traceback", "...", "Error!"]
editor.message(c.msg, msg_type=const.ERROR)
with m:
bar.message(c.text, **kw)
c = TestConfig(text="command error", exc_info=None)
yield test, c(msg="command error")
yield test, c(msg="command error\n\nTraceback...Error!", exc_info=True)