本文整理汇总了Python中static_precompiler.compilers.base.BaseCompiler.get_full_output_path方法的典型用法代码示例。如果您正苦于以下问题:Python BaseCompiler.get_full_output_path方法的具体用法?Python BaseCompiler.get_full_output_path怎么用?Python BaseCompiler.get_full_output_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static_precompiler.compilers.base.BaseCompiler
的用法示例。
在下文中一共展示了BaseCompiler.get_full_output_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_full_output_path
# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_output_path [as 别名]
def test_get_full_output_path(self):
compiler = BaseCompiler()
compiler.get_output_path = MagicMock(
return_value=OUTPUT_DIR + "/dummy.js")
self.assertEqual(
compiler.get_full_output_path("dummy.coffee"),
os.path.join(ROOT, OUTPUT_DIR, "dummy.js"))
示例2: test_write_output
# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_output_path [as 别名]
def test_write_output(self):
compiler = BaseCompiler()
output_path = os.path.join(ROOT, OUTPUT_DIR, "dummy.js")
self.assertFalse(os.path.exists(output_path))
compiler.get_full_output_path = MagicMock(return_value=output_path)
compiler.write_output("compiled", "dummy.coffee")
self.assertTrue(os.path.exists(output_path))
self.assertEqual(open(output_path).read(), "compiled")
示例3: test_get_output_mtime
# 需要导入模块: from static_precompiler.compilers.base import BaseCompiler [as 别名]
# 或者: from static_precompiler.compilers.base.BaseCompiler import get_full_output_path [as 别名]
def test_get_output_mtime(self):
compiler = BaseCompiler()
compiler.get_full_output_path = MagicMock(return_value="dummy.js")
with patch("os.path.exists") as mocked_os_path_exists:
mocked_os_path_exists.return_value = False
self.assertEqual(compiler.get_output_mtime("dummy.coffee"), None)
mocked_os_path_exists.assert_called_with("dummy.js")
mocked_os_path_exists.return_value = True
with patch("static_precompiler.compilers.base.get_mtime") as mocked_get_mtime:
mocked_get_mtime.return_value = 1
self.assertEqual(compiler.get_output_mtime("dummy.coffee"), 1)
mocked_get_mtime.assert_called_with("dummy.js")