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


Python macro.Macro类代码示例

本文整理汇总了Python中Terminality.macro.Macro的典型用法代码示例。如果您正苦于以下问题:Python Macro类的具体用法?Python Macro怎么用?Python Macro使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_selection2

    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"
        )
开发者ID:Eronana,项目名称:Terminality,代码行数:29,代码来源:test_macro_internal.py

示例2: test_file_path

 def test_file_path(self, active_window):
     self.assertEqual(
         Macro.get_file_path(),
         "path/to/file.ext"
     )
     self.assertEqual(
         Macro.get_file_name(),
         "file.ext"
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例3: test_parent_dir2

 def test_parent_dir2(self, active_window):
     self.assertEqual(
         Macro.get_parent_dir(),
         None
     )
     self.assertEqual(
         Macro.get_parent_name(),
         None
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例4: test_parent_dir

 def test_parent_dir(self, active_window):
     self.assertEqual(
         Macro.get_parent_dir(),
         "path/to"
     )
     self.assertEqual(
         Macro.get_parent_name(),
         "to"
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例5: test_file_path2

 def test_file_path2(self, active_window):
     self.assertEqual(
         Macro.get_file_path(),
         None
     )
     self.assertEqual(
         Macro.get_file_name(),
         None
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例6: test_working_project_dir

 def test_working_project_dir(self, active_window):
     self.assertEqual(
         Macro.get_working_project_dir(),
         "path/to"
     )
     self.assertEqual(
         Macro.get_working_project_name(),
         "to"
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例7: test_working_project_dir2

 def test_working_project_dir2(self, active_window):
     self.assertEqual(
         Macro.get_working_project_dir(),
         None
     )
     self.assertEqual(
         Macro.get_working_project_name(),
         None
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例8: test_project_dir2

 def test_project_dir2(self, active_window):
     self.assertEqual(
         Macro.get_project_dir(),
         "another/path/to/directory"
     )
     self.assertEqual(
         Macro.get_project_name(),
         "directory"
     )
开发者ID:Eronana,项目名称:Terminality,代码行数:9,代码来源:test_macro_internal.py

示例9: test_regex_macro

    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,代码行数:31,代码来源:test_macro_parser.py

示例10: test_predefined_macro2

    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,代码行数:16,代码来源:test_macro_parser.py

示例11: test_empty

    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,代码行数:16,代码来源:test_macro_parser.py

示例12: test_none

    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,代码行数:16,代码来源:test_macro_parser.py

示例13: test_predefined_macro5

    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,代码行数:16,代码来源:test_macro_parser.py

示例14: test_predefined_macro3

    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,代码行数:16,代码来源:test_macro_parser.py

示例15: test_required_macro7

    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,代码行数:16,代码来源:test_macro_parser.py


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