本文整理汇总了Python中WMCore.Algorithms.BasicAlgos.getFileInfo方法的典型用法代码示例。如果您正苦于以下问题:Python BasicAlgos.getFileInfo方法的具体用法?Python BasicAlgos.getFileInfo怎么用?Python BasicAlgos.getFileInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Algorithms.BasicAlgos
的用法示例。
在下文中一共展示了BasicAlgos.getFileInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStripReport
# 需要导入模块: from WMCore.Algorithms import BasicAlgos [as 别名]
# 或者: from WMCore.Algorithms.BasicAlgos import getFileInfo [as 别名]
def testStripReport(self):
"""
_testStripReport_
Test whether or not we can strip input file information
from a FWJR and create a smaller object.
"""
myReport = Report("cmsRun1")
myReport.parse(self.xmlPath)
path1 = os.path.join(self.testDir, 'testReport1.pkl')
path2 = os.path.join(self.testDir, 'testReport2.pkl')
myReport.save(path1)
info = BasicAlgos.getFileInfo(filename = path1)
self.assertEqual(info['Size'], 7101)
inputFiles = myReport.getAllInputFiles()
self.assertEqual(len(inputFiles), 1)
myReport.stripInputFiles()
self.assertEqual(len(myReport.getAllInputFiles()), 0)
myReport.save(path2)
info = BasicAlgos.getFileInfo(filename = path2)
self.assertEqual(info['Size'], 6210)
return
示例2: test_fileInfo
# 需要导入模块: from WMCore.Algorithms import BasicAlgos [as 别名]
# 或者: from WMCore.Algorithms.BasicAlgos import getFileInfo [as 别名]
def test_fileInfo(self):
"""
_fileInfo_
Test for basic file info
"""
silly = "This is a rather ridiculous string"
filename = os.path.join(self.testDir, 'fileInfo.test')
f = open(filename, 'w')
f.write(silly)
f.close()
info = BasicAlgos.getFileInfo(filename = filename)
self.assertEqual(info['Name'], filename)
self.assertEqual(info['Size'], 34)
return