本文整理汇总了Python中tempfile._RandomNameSequence方法的典型用法代码示例。如果您正苦于以下问题:Python tempfile._RandomNameSequence方法的具体用法?Python tempfile._RandomNameSequence怎么用?Python tempfile._RandomNameSequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tempfile
的用法示例。
在下文中一共展示了tempfile._RandomNameSequence方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def setUp(self):
self.r = tempfile._RandomNameSequence()
示例2: test_get_six_char_str
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_get_six_char_str(self):
# _RandomNameSequence returns a six-character string
s = self.r.next()
self.nameCheck(s, '', '', '')
示例3: test_many
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_many(self):
# _RandomNameSequence returns no duplicate strings (stochastic)
dict = {}
r = self.r
for i in xrange(TEST_FILES):
s = r.next()
self.nameCheck(s, '', '', '')
self.assertNotIn(s, dict)
dict[s] = 1
示例4: test_supports_iter
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_supports_iter(self):
# _RandomNameSequence supports the iterator protocol
i = 0
r = self.r
try:
for s in r:
i += 1
if i == 20:
break
except:
self.failOnException("iteration")
示例5: test_retval
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_retval(self):
# _get_candidate_names returns a _RandomNameSequence object
obj = tempfile._get_candidate_names()
self.assertIsInstance(obj, tempfile._RandomNameSequence)
示例6: generate_temp_file_path
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def generate_temp_file_path(extension: str) -> str:
return TEMP_PATH_BASE + next(tempfile._RandomNameSequence()) + extension
示例7: setUp
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def setUp(self):
self.r = tempfile._RandomNameSequence()
super().setUp()
示例8: test_get_six_char_str
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_get_six_char_str(self):
# _RandomNameSequence returns a six-character string
s = next(self.r)
self.nameCheck(s, '', '', '')
示例9: test_many
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def test_many(self):
# _RandomNameSequence returns no duplicate strings (stochastic)
dict = {}
r = self.r
for i in range(TEST_FILES):
s = next(r)
self.nameCheck(s, '', '', '')
self.assertNotIn(s, dict)
dict[s] = 1
示例10: supports_iter
# 需要导入模块: import tempfile [as 别名]
# 或者: from tempfile import _RandomNameSequence [as 别名]
def supports_iter(self):
# _RandomNameSequence supports the iterator protocol
i = 0
r = self.r
for s in r:
i += 1
if i == 20:
break