本文整理汇总了Python中mocker.Mocker.order方法的典型用法代码示例。如果您正苦于以下问题:Python Mocker.order方法的具体用法?Python Mocker.order怎么用?Python Mocker.order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mocker.Mocker
的用法示例。
在下文中一共展示了Mocker.order方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ChangeIndentationController_save_options
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import order [as 别名]
def test_ChangeIndentationController_save_options():
m = Mocker()
tv = m.mock(TextView)
dv = tv.doc_view >> m.mock(TextDocumentView)
with m.order():
mode = dv.indent_mode >> "<indent mode>"
size = dv.indent_size >> "<indent size>"
with m:
ctl = ChangeIndentationController.create_with_textview(tv)
ctl.save_options()
示例2: test
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import order [as 别名]
def test(args=()):
with test_app() as ac:
m = Mocker()
ed_class = m.replace(window, 'Window')
ed = ed_class(ac, args[0] if args else None) >> m.mock(window.Window)
with m.order():
ac.windows.append(ed)
ed.show(ac)
with m:
result = ac.create_window(*args)
eq_(result, ed)
示例3: test
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import order [as 别名]
def test(args):
ac = Application()
m = Mocker()
ed_class = m.replace(editor, 'Editor')
wc_class = m.replace(editor, 'EditorWindowController')
wc = wc_class.alloc() >> m.mock(editor.EditorWindowController)
wc.initWithWindowNibName_("EditorWindow") >> wc
ed = ed_class(ac, wc, args[0] if args else None) >> m.mock(editor.Editor)
wc.editor = ed
#ed = wc.controller >> m.mock(Editor)
#wc_class.create_with_serial_data(args[0] if args else None) >> wc
with m.order():
ac.editors.append(ed)
wc.showWindow_(ac)
with m:
result = ac.create_editor(*args)
eq_(result, ed)
示例4: test_wait_for_presence_works_even_when_is_visible_raises
# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import order [as 别名]
def test_wait_for_presence_works_even_when_is_visible_raises():
mocker = Mocker()
context = Context(Settings())
selenium_mock = mocker.mock()
selenium_mock.is_element_present('some element')
mocker.count(min=1, max=None)
mocker.result(True)
with mocker.order():
selenium_mock.is_visible('some element')
mocker.throw(Exception("ERROR: Element some element not found"))
selenium_mock.is_visible('some element')
mocker.result(True)
with mocker:
driver = SeleniumDriver(context, selenium=selenium_mock)
driver.wait_for_element_present("some element", 1)