当前位置: 首页>>代码示例>>Python>>正文


Python Mocker.property方法代码示例

本文整理汇总了Python中mocker.Mocker.property方法的典型用法代码示例。如果您正苦于以下问题:Python Mocker.property方法的具体用法?Python Mocker.property怎么用?Python Mocker.property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mocker.Mocker的用法示例。


在下文中一共展示了Mocker.property方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [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)
开发者ID:editxt,项目名称:editxt,代码行数:29,代码来源:test_document.py

示例2: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     m = Mocker()
     fc = FindController.shared_controller()
     regexfind = m.method(fc.regexfinditer)
     simplefind = m.method(fc.simplefinditer)
     rfr = m.property(fc, "recently_found_range")
     sel = NSMakeRange(1, 2)
     direction = "<direction>"
     opts = m.property(fc, "opts").value >> m.mock(FindOptions)
     ftext = u"<find>"
     if opts.regular_expression >> c.regex:
         finditer = regexfind
     elif opts.match_entire_word >> c.mword:
         finditer = regexfind
         ftext = u"\\b" + re.escape(ftext) + u"\\b"
     else:
         finditer = simplefind
     range = NSMakeRange(sel.location, 0)
     items = []
     rng = None
     for i, r in enumerate(c.matches):
         if r is WRAPTOKEN:
             items.append(r)
             continue
         found = FoundRange(NSMakeRange(*r))
         items.append(found)
         if i == 0 and found.range == sel:
             continue
         rfr.value = found
         rng = found.range
     finditer(u"<text>", ftext, range, direction, True) >> items
     with m:
         result = fc._find(u"<text>", u"<find>", sel, direction)
         eq_(result, rng)
开发者ID:youngrok,项目名称:editxt,代码行数:36,代码来源:test_findpanel.py

示例3: test_FindController_show_find_panel

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
def test_FindController_show_find_panel():
    m = Mocker()
    fc = FindController.shared_controller()
    sender = m.mock()
    m.property(fc, "opts")
    m.property(fc, "find_text")
    #fc.opts.load()
    m.method(fc.showWindow_)(fc)
    #fc.find_text.setStringValue_(fc.opts.find_text >> "abc")
    fc.find_text.selectText_(sender)
    with m:
        fc.show_find_panel(sender)
开发者ID:youngrok,项目名称:editxt,代码行数:14,代码来源:test_findpanel.py

示例4: test_FindController_show_find_panel

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
def test_FindController_show_find_panel():
    m = Mocker()
    fc = FindController.shared_controller()
    sender = m.mock()
    opts = m.property(fc, "options").value
    opts.willChangeValueForKey_("recent_finds")
    m.method(fc.load_options)()
    opts.didChangeValueForKey_("recent_finds")
    m.property(fc, "find_text")
    m.method(fc.gui.showWindow_)(fc)
    fc.find_text.selectText_(sender)
    with m:
        fc.show_find_panel(sender)
开发者ID:khairy,项目名称:editxt,代码行数:15,代码来源:test_find.py

示例5: test_FindController_show_find_panel

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
def test_FindController_show_find_panel():
    with test_app() as app:
        m = Mocker()
        fc = FindController(app)
        sender = m.mock()
        opts = m.property(fc, "options").value
        opts.willChangeValueForKey_("recent_finds")
        m.method(fc.load_options)()
        opts.didChangeValueForKey_("recent_finds")
        m.property(fc, "find_text")
        m.method(fc.gui.show)()
        with m:
            fc.show_find_panel(sender)
开发者ID:editxt,项目名称:editxt,代码行数:15,代码来源:test_find.py

示例6: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     app = Application()
     m = Mocker()
     opc_class = m.replace(OpenPathController, passthrough=False)
     opc = m.mock(OpenPathController)
     m.property(app, "path_opener").value >> (opc if c.exists else None)
     if c.exists:
         app.path_opener.window().makeKeyAndOrderFront_(app)
     else:
         (opc_class.alloc() >> opc).initWithWindowNibName_("OpenPath") >> opc
         app.path_opener = opc
         opc.showWindow_(app)
     app.path_opener.populateWithClipboard()
     with m:
         app.open_path_dialog()
开发者ID:youngrok,项目名称:editxt,代码行数:17,代码来源:test_application.py

示例7: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     app = Application()
     m = Mocker()
     opc_class = m.replace(mod, 'OpenPathController')
     opc = m.mock(mod.OpenPathController)
     m.property(app, "path_opener").value >> (opc if c.exists else None)
     if c.exists:
         app.path_opener.window().makeKeyAndOrderFront_(app)
     else:
         opc_class(app) >> opc
         app.path_opener = opc
         opc.showWindow_(app)
     app.path_opener.populateWithClipboard()
     with m:
         app.open_path_dialog()
开发者ID:editxt,项目名称:editxt,代码行数:17,代码来源:test_application.py

示例8: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     m = Mocker()
     app = m.replace(editxt, 'app')
     opc = OpenPathController.alloc().init()
     paths = m.property(opc, "paths").value >> m.mock(ak.NSTextView)
     paths.textStorage().string() >> c.text
     app.open_documents_with_paths(c.paths)
     (m.method(opc.window)() >> m.mock(ak.NSWindow)).orderOut_(opc)
     with m:
         opc.open_(None)
开发者ID:khairy,项目名称:editxt,代码行数:12,代码来源:test_application.py

示例9: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     m = Mocker()
     hbc = HoverButtonCell.alloc().init()
     frame = m.mock(NSRect)
     view = m.mock(NSOutlineView)
     point, pressed = hbc.hover_info = c.info
     if point is not None:
         m.replace(NSPointInRect)(point, frame) >> (point == "in")
     row = view.rowAtPoint_(frame.origin >> (1, 1)) >> 2
     dgt = m.property(hbc, "delegate").value >> m.mock(EditorWindowController)
     image = dgt.hoverButtonCell_imageForState_row_(hbc, c.state, row) >> "<img>"
     with m:
         eq_(hbc.buttonImageForFrame_inView_(frame, view), image)
开发者ID:youngrok,项目名称:editxt,代码行数:15,代码来源:test_cells.py

示例10: test_OpenPathController_windowDidLoad

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
def test_OpenPathController_windowDidLoad():
    m = Mocker()
    opc = OpenPathController.alloc().init()
    tv = m.property(opc, "paths").value >> m.mock(ak.NSTextView)
    tc = tv.textContainer() >> m.mock(ak.NSTextContainer)
    tc.setContainerSize_(fn.NSMakeSize(const.LARGE_NUMBER_FOR_TEXT, const.LARGE_NUMBER_FOR_TEXT))
    tc.setWidthTracksTextView_(False)
    tv.setHorizontallyResizable_(True)
    tv.setAutoresizingMask_(ak.NSViewNotSizable)
    tv.setFieldEditor_(True)
    tv.setFont_(ANY)
    with m:
        opc.windowDidLoad()
开发者ID:khairy,项目名称:editxt,代码行数:15,代码来源:test_application.py

示例11: test

# 需要导入模块: from mocker import Mocker [as 别名]
# 或者: from mocker.Mocker import property [as 别名]
 def test(c):
     m = Mocker()
     fc = FindController.shared_controller()
     tv = m.mock(TextView)
     regexfind = m.method(fc.finder.regexfinditer)
     simplefind = m.method(fc.finder.simplefinditer)
     sel = fn.NSMakeRange(1, 2)
     direction = "<direction>"
     options = m.property(fc.finder, "options").value >> m.mock(FindOptions)
     ftext = "<find>"
     if options.regular_expression >> c.regex:
         finditer = regexfind
     elif options.match_entire_word >> c.mword:
         finditer = regexfind
         ftext = "\\b" + re.escape(ftext) + "\\b"
     else:
         finditer = simplefind
     range = fn.NSMakeRange(sel.location, 0)
     items = []
     rng = None
     tv.string() >> "<text>"
     FoundRange = make_found_range_factory(
         FindOptions(regular_expression=c.regex, match_entire_word=c.mword))
     for i, r in enumerate(c.matches):
         if r is mod.WRAPTOKEN:
             items.append(r)
             continue
         found = FoundRange(fn.NSMakeRange(*r))
         items.append(found)
         if i == 0 and found.range == sel:
             continue
         tv._Finder__recently_found_range = found
         rng = found.range
     finditer("<text>", ftext, range, direction, True) >> items
     with m:
         result = fc.finder._find(tv, "<find>", sel, direction)
         eq_(result, rng)
开发者ID:khairy,项目名称:editxt,代码行数:39,代码来源:test_find.py


注:本文中的mocker.Mocker.property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。