本文整理汇总了Python中cdo.Cdo.cleanTempDir方法的典型用法代码示例。如果您正苦于以下问题:Python Cdo.cleanTempDir方法的具体用法?Python Cdo.cleanTempDir怎么用?Python Cdo.cleanTempDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.cleanTempDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTempdir
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import cleanTempDir [as 别名]
def testTempdir(self):
# manual set path
tempPath = os.path.abspath('.')+'/tempPy_{0}'.format( random.randrange(1,100000))
cdo = Cdo(tempdir=tempPath)
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(1,len(os.listdir(tempPath)))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(3,len(os.listdir(tempPath)))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(5,len(os.listdir(tempPath)))
cdo.cleanTempDir()
self.assertEqual(0,len(os.listdir(tempPath)))
示例2: test_system_tempdir
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import cleanTempDir [as 别名]
def test_system_tempdir(self):
# automatic path
tempPath = tempfile.gettempdir()
cdo = Cdo()
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(1,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(3,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
cdo.topo('r10x10',options = '-f nc')
self.assertEqual(12,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))
cdo.cleanTempDir()
self.assertEqual(0,len([ f for f in os.listdir(tempPath) if 'cdoPy' in f]))