當前位置: 首頁>>代碼示例>>Python>>正文


Python Macro.parse_macro方法代碼示例

本文整理匯總了Python中Terminality.macro.Macro.parse_macro方法的典型用法代碼示例。如果您正苦於以下問題:Python Macro.parse_macro方法的具體用法?Python Macro.parse_macro怎麽用?Python Macro.parse_macro使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Terminality.macro.Macro的用法示例。


在下文中一共展示了Macro.parse_macro方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_regex_macro

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_regex_macro(self, active_window):
        macros = {
            "test": "$custom;$custom2;$custom3;$custom4",
            "expected": ".ext;.ext;.ext;.ext",
            "required": [],
            "macros": {
                "custom": [
                    "$file",
                    ["\\.\\w+$"]
                ],
                "custom2": [
                    "$file_name",
                    ["\\.\\w+$"]
                ],
                "custom3": [
                    ["$file", "\\.\\w+$"]
                ],
                "custom4": [
                    ["$file_name", "\\.\\w+$"]
                ]
            }
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:33,代碼來源:test_macro_parser.py

示例2: test_predefined_macro3

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_predefined_macro3(self, active_window):
        macros = {
            "test": "$require ; $file",
            "expected": " ; path/to/file.ext",
            "required": [],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例3: test_predefined_macro2

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_predefined_macro2(self, active_window):
        macros = {
            "test": "$file_name",
            "expected": None,
            "required": ["required", "file_name"],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例4: test_none

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_none(self, active_window):
        macros = {
            "test": None,
            "expected": None,
            "required": None,
            "macros": None
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例5: test_empty

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_empty(self, active_window):
        macros = {
            "test": "",
            "expected": "",
            "required": [],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例6: test_predefined_macro5

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_predefined_macro5(self, active_window):
        macros = {
            "test": "$working$$$working_project$$$project",
            "expected": "path/to$path/to$another/path/to/directory",
            "required": [],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例7: test_required_macro7

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_required_macro7(self, active_window):
        macros = {
            "test": "$selection",
            "expected": None,
            "required": ["selection"],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:Eronana,項目名稱:Terminality,代碼行數:18,代碼來源:test_macro_parser.py

示例8: test_required_macro9

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_required_macro9(self, active_window):
        MockView.sel.return_value = [sublime.Region(5, 10)]
        macros = {
            "test": "$selection",
            "expected": "Hello",
            "required": ["selection"],
            "macros": {}
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:Eronana,項目名稱:Terminality,代碼行數:19,代碼來源:test_macro_parser.py

示例9: test_recursion_macro2

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_recursion_macro2(self, active_window):
        macros = {
            "test": "$required",
            "expected": "",
            "required": [],
            "macros": {
                "required": [
                    "$required2"
                ],
                "required2": [
                    "$required"
                ]
            }
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:25,代碼來源:test_macro_parser.py

示例10: test_required_macro5

# 需要導入模塊: from Terminality.macro import Macro [as 別名]
# 或者: from Terminality.macro.Macro import parse_macro [as 別名]
    def test_required_macro5(self, active_window):
        macros = {
            "test": "$required",
            "expected": "",
            "required": [],
            "macros": {
                "required": [
                    1,
                    [1, 2],
                    None,
                    [None, None]
                ]
            }
        }

        self.assertEqual(
            Macro.parse_macro(
                string=macros["test"],
                custom_macros=macros["macros"],
                required=macros["required"]
            ),
            macros["expected"]
        )
開發者ID:utensil-contrib,項目名稱:Terminality,代碼行數:25,代碼來源:test_macro_parser.py


注:本文中的Terminality.macro.Macro.parse_macro方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。