本文整理匯總了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),
" "
)