本文整理汇总了Python中staticgenerator.StaticGenerator.get_filename_from_path方法的典型用法代码示例。如果您正苦于以下问题:Python StaticGenerator.get_filename_from_path方法的具体用法?Python StaticGenerator.get_filename_from_path怎么用?Python StaticGenerator.get_filename_from_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staticgenerator.StaticGenerator
的用法示例。
在下文中一共展示了StaticGenerator.get_filename_from_path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_filename_from_path_when_path_ends_with_slash
# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import get_filename_from_path [as 别名]
def test_get_filename_from_path_when_path_ends_with_slash():
mox = Mox()
http_request, model_base, manager, model, queryset = get_mocks(mox)
settings = CustomSettings(WEB_ROOT="test_web_root")
fs_mock = mox.CreateMockAnything()
fs_mock.join("test_web_root", "foo/bar/index.html").AndReturn("test_web_root/foo/bar/index.html")
fs_mock.dirname("test_web_root/foo/bar/index.html").AndReturn("test_web_root/foo/bar")
path_mock = '/foo/bar/'
mox.ReplayAll()
instance = StaticGenerator(http_request=http_request,
model_base=model_base,
manager=manager,
model=model,
queryset=queryset,
settings=settings,
fs=fs_mock)
result = instance.get_filename_from_path(path_mock)
assert result == ('test_web_root/foo/bar/index.html', 'test_web_root/foo/bar')
mox.VerifyAll()
示例2: test_get_lang_aware_filename_from_path_when_path_ends_with_slash
# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import get_filename_from_path [as 别名]
def test_get_lang_aware_filename_from_path_when_path_ends_with_slash(self):
for lang in ('uk', 'ru'):
# activate first non-default language
if lang != settings.LANGUAGE_CODE:
activate('ru')
instance = StaticGenerator()
result = instance.get_filename_from_path('/foo/bar/', '')
self.assertEqual('test_web_root/foo/bar/{}.index.html%3F'.format(lang),
result)
示例3: test_get_filename_from_path_when_path_ends_with_slash
# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import get_filename_from_path [as 别名]
def test_get_filename_from_path_when_path_ends_with_slash(self):
instance = StaticGenerator()
result = instance.get_filename_from_path('/foo/bar/', '')
self.assertEqual('test_web_root/foo/bar/index.html%3F', result)
示例4: test_get_filename_from_path
# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import get_filename_from_path [as 别名]
def test_get_filename_from_path(self):
instance = StaticGenerator()
result = instance.get_filename_from_path('/foo/bar', '')
self.assertEqual('test_web_root/foo/bar', result)