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