本文整理汇总了Python中ikalog.utils.IkaUtils.get_file_name方法的典型用法代码示例。如果您正苦于以下问题:Python IkaUtils.get_file_name方法的具体用法?Python IkaUtils.get_file_name怎么用?Python IkaUtils.get_file_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ikalog.utils.IkaUtils
的用法示例。
在下文中一共展示了IkaUtils.get_file_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_file_name
# 需要导入模块: from ikalog.utils import IkaUtils [as 别名]
# 或者: from ikalog.utils.IkaUtils import get_file_name [as 别名]
def test_get_file_name(self):
mock_context = {'game': {'index': 0},
'engine': {'source_file': None}}
self.assertIsNone(IkaUtils.get_file_name(None, mock_context))
self.assertEqual('/tmp/statink.msgpack',
IkaUtils.get_file_name('/tmp/statink.msgpack',
mock_context))
mock_context['game']['index'] = 1
self.assertEqual('/tmp/statink-1.msgpack',
IkaUtils.get_file_name('/tmp/statink.msgpack',
mock_context))
mock_context['game']['index'] = 10
self.assertEqual('/tmp/statink-10.msgpack',
IkaUtils.get_file_name('/tmp/statink.msgpack',
mock_context))
mock_context['game']['index'] = 1
self.assertEqual('/tmp/video.mp4-1.statink',
IkaUtils.get_file_name('/tmp/video.mp4.statink',
mock_context))
self.assertEqual('/tmp/video.mp4-1.statink',
IkaUtils.get_file_name('/tmp/video.mp4.statink',
mock_context))
mock_context['engine']['source_file'] = None
mock_context['game']['index'] = 0
self.assertEqual('__INPUT_FILE__.statink',
IkaUtils.get_file_name('__INPUT_FILE__.statink',
mock_context))
mock_context['engine']['source_file'] = None
mock_context['game']['index'] = 2
self.assertEqual('__INPUT_FILE__-2.statink',
IkaUtils.get_file_name('__INPUT_FILE__.statink',
mock_context))
mock_context['engine']['source_file'] = '/tmp/video.mp4'
mock_context['game']['index'] = 0
self.assertEqual('/tmp/video.mp4.statink',
IkaUtils.get_file_name('__INPUT_FILE__.statink',
mock_context))
mock_context['engine']['source_file'] = '/tmp/video.mp4'
mock_context['game']['index'] = 3
self.assertEqual('/tmp/video.mp4-3.statink',
IkaUtils.get_file_name('__INPUT_FILE__.statink',
mock_context))