本文整理匯總了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))