本文整理汇总了Python中mocker.Mocker.off_the_record方法的典型用法代码示例。如果您正苦于以下问题:Python Mocker.off_the_record方法的具体用法?Python Mocker.off_the_record怎么用?Python Mocker.off_the_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mocker.Mocker
的用法示例。
在下文中一共展示了Mocker.off_the_record方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import off_the_record [as 别名]
def test(app, c):
m = Mocker()
doc = TextDocument(app)
with m.off_the_record():
doc.text_storage = ts = m.mock(ak.NSTextStorage)
app.syntax_factory = m.mock(SyntaxFactory)
m.property(doc, "syntaxdef")
m.property(doc, "props")
syn = doc.syntaxer = m.mock(Highlighter)
color_text = m.method(doc.color_text)
syn.filename >> "<filename %s>" % ("0" if c.namechange else "1")
new = doc.file_path = "<filename 1>"
colored = False
if c.namechange:
syn.filename = new
sdef = app.syntax_factory.get_definition(new) >> m.mock(SyntaxDefinition)
doc.syntaxdef >> (None if c.newdef else sdef)
if c.newdef:
doc.props.syntaxdef = sdef
color_text()
colored = True
doc.syntax_needs_color = c.needs_color
if c.needs_color and not colored:
color_text()
with m:
doc.update_syntaxer()
eq_(doc.syntax_needs_color, False)
示例2: test_TextDocument_color_text_with_null_text_storage
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import off_the_record [as 别名]
def test_TextDocument_color_text_with_null_text_storage(app):
m = Mocker()
doc = TextDocument(app)
with m.off_the_record():
doc.text_storage = None
syn = doc.syntaxer = m.mock()
range = (0, 20)
with m:
doc.color_text(range)
示例3: test_TextDocument_on_text_edit
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import off_the_record [as 别名]
def test_TextDocument_on_text_edit(app):
from editxt.syntax import Highlighter
m = Mocker()
doc = TextDocument(app)
with m.off_the_record():
ts = doc.text_storage = m.mock(ak.NSTextStorage)
ts.editedMask() >> -1
syn = doc.syntaxer = m.mock(Highlighter)
range = (0, 20)
syn.color_text(ts, range, timeout=0.05)
with m:
doc.on_text_edit(range)