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


Python BaseCompiler.get_full_source_path方法代码示例

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


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

示例1: test_get_full_source_path

# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_source_path [as 别名]
    def test_get_full_source_path(self):

        compiler = BaseCompiler()

        root = os.path.dirname(__file__)

        self.assertEqual(
            compiler.get_full_source_path("scripts/test.coffee"),
            os.path.join(root, "static", "scripts", "test.coffee"),
        )

        # Source file doesn't exist
        self.assertRaises(
            ValueError,
            lambda: compiler.get_full_source_path("scripts/does-not-exist.coffee")
        )

        self.assertEqual(
            compiler.get_full_source_path("another_test.coffee"),
            os.path.normpath(
                os.path.join(root, "staticfiles_dir", "another_test.coffee")))

        self.assertEqual(
            compiler.get_full_source_path("prefix/another_test.coffee"),
            os.path.normpath(
                os.path.join(root, "staticfiles_dir_with_prefix",
                             "another_test.coffee")))
开发者ID:pombredanne,项目名称:django-static-precompiler,代码行数:29,代码来源:test_base_compiler.py

示例2: test_get_source_mtime

# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_source_path [as 别名]
 def test_get_source_mtime(self):
     compiler = BaseCompiler()
     compiler.get_full_source_path = MagicMock(return_value="dummy.coffee")
     with patch("static_precompiler.compilers.base.get_mtime") as mocked_get_mtime:
         mocked_get_mtime.return_value = 1
         self.assertEqual(compiler.get_source_mtime("dummy.coffee"), 1)
         mocked_get_mtime.assert_called_with("dummy.coffee")
         #noinspection PyUnresolvedReferences
         compiler.get_full_source_path.assert_called_with("dummy.coffee")
开发者ID:vincenzorizza,项目名称:pinseri,代码行数:11,代码来源:test_base_compiler.py

示例3: test_get_full_source_path

# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_source_path [as 别名]
    def test_get_full_source_path(self):

        compiler = BaseCompiler()

        # Source file in STATIC_ROOT
        self.assertEqual(
            compiler.get_full_source_path("scripts/test.coffee"),
            os.path.join(self.django_settings.STATIC_ROOT, "scripts/test.coffee"),
        )

        # Source file doesn't exist
        self.assertRaises(
            ValueError,
            lambda: compiler.get_full_source_path("scripts/does-not-exist.coffee")
        )

        self.assertEqual(self.django_settings.DEBUG, True)

        self.assertEqual(
            compiler.get_full_source_path("another_test.coffee"),
            os.path.normpath(
                os.path.join(
                    self.django_settings.STATIC_ROOT,
                    "..",
                    "staticfiles_dir",
                    "another_test.coffee"
                )
            )
        )

        self.assertEqual(
            compiler.get_full_source_path("prefix/another_test.coffee"),
            os.path.normpath(
                os.path.join(
                    self.django_settings.STATIC_ROOT,
                    "..",
                    "staticfiles_dir_with_prefix",
                    "another_test.coffee"
                )
            )
        )
开发者ID:bmcool,项目名称:django-static-precompiler,代码行数:43,代码来源:test_base_compiler.py


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