本文整理汇总了Python中Terminality.macro.Macro.get_selection方法的典型用法代码示例。如果您正苦于以下问题:Python Macro.get_selection方法的具体用法?Python Macro.get_selection怎么用?Python Macro.get_selection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminality.macro.Macro
的用法示例。
在下文中一共展示了Macro.get_selection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_selection2
# 需要导入模块: from Terminality.macro import Macro [as 别名]
# 或者: from Terminality.macro.Macro import get_selection [as 别名]
def test_selection2(self, active_window):
MockView.sel.return_value = [sublime.Region(5, 10)]
self.assertEqual(
Macro.get_selection(raw=False),
"Hello"
)
MockView.sel.return_value = [
sublime.Region(5, 10),
sublime.Region(12, 17)
]
self.assertEqual(
Macro.get_selection(raw=False),
"World"
)
MockView.sel.return_value = [
sublime.Region(5, 10),
sublime.Region(12, 17),
sublime.Region(11, 17)
]
self.assertEqual(
Macro.get_selection(raw=False),
"World"
)
self.assertEqual(
Macro.get_selection(raw=True),
" World"
)
示例2: test_selection
# 需要导入模块: from Terminality.macro import Macro [as 别名]
# 或者: from Terminality.macro.Macro import get_selection [as 别名]
def test_selection(self, active_window):
self.assertEqual(
Macro.get_selection(raw=False),
None
)
self.assertEqual(
Macro.get_selection(raw=True),
None
)
MockView.sel.return_value = []
self.assertEqual(
Macro.get_selection(raw=False),
None
)
self.assertEqual(
Macro.get_selection(raw=True),
None
)
MockView.sel.return_value = [sublime.Region(11, 11)]
self.assertEqual(
Macro.get_selection(raw=False),
None
)
self.assertEqual(
Macro.get_selection(raw=True),
None
)
MockView.sel.return_value = [sublime.Region(11, 12)]
self.assertEqual(
Macro.get_selection(raw=False),
None
)
self.assertEqual(
Macro.get_selection(raw=True),
" "
)