Lines Matching refs:suf
81 def nameCheck(self, name, dir, pre, suf): argument
84 nsuf = nbase[len(nbase)-len(suf):]
92 if suf is not None:
93 self.assertIs(type(name), str if type(suf) is str else bytes,
95 if (dir, pre, suf) == (None, None, None):
103 self.assertEqual(nsuf, suf,
104 "file %r does not end with %r" % (nbase, suf))
106 nbase = nbase[len(pre):len(nbase)-len(suf)]
367 def __init__(self, dir, pre, suf, bin): argument
371 output_type = tempfile._infer_return_type(dir, pre, suf)
372 (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags, output_type)
381 def do_create(self, dir=None, pre=None, suf=None, bin=1): argument
382 output_type = tempfile._infer_return_type(dir, pre, suf)
390 if suf is None:
391 suf = output_type()
392 file = self.mkstemped(dir, pre, suf, bin)
394 self.nameCheck(file.name, dir, pre, suf)
401 self.do_create(suf="b").write(b"blat")
402 self.do_create(pre="a", suf="b").write(b"blat")
403 self.do_create(pre="aa", suf=".txt").write(b"blat")
409 self.do_create(dir=dir_b, suf=b"").write(b"blat")
411 self.do_create(dir=dir_b, suf=b"b").write(b"blat")
412 self.do_create(dir=dir_b, pre=b"a", suf=b"b").write(b"blat")
413 self.do_create(dir=dir_b, pre=b"aa", suf=b".txt").write(b"blat")
416 self.do_create(dir="", suf=b"").write(b"blat")
420 self.do_create(dir=dir_b, pre=b"", suf="").write(b"blat")
614 def do_create(self, dir=None, pre=None, suf=None): argument
615 output_type = tempfile._infer_return_type(dir, pre, suf)
623 if suf is None:
624 suf = output_type()
625 (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf)
632 self.nameCheck(name, dir, pre, suf)
641 self.do_create(suf="b")
642 self.do_create(pre="a", suf="b")
643 self.do_create(pre="aa", suf=".txt")
650 self.do_create(dir=d, suf=b"")
652 self.do_create(dir=d, suf=b"b")
653 self.do_create(dir=d, pre=b"a", suf=b"b")
654 self.do_create(dir=d, pre=b"aa", suf=b".txt")
657 self.do_create(dir=".", pre=b"aa", suf=b".txt")
659 self.do_create(dir=b".", pre="aa", suf=b".txt")
661 self.do_create(dir=b".", pre=b"aa", suf=".txt")
679 def do_create(self, dir=None, pre=None, suf=None): argument
680 output_type = tempfile._infer_return_type(dir, pre, suf)
688 if suf is None:
689 suf = output_type()
690 name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf)
693 self.nameCheck(name, dir, pre, suf)
703 os.rmdir(self.do_create(suf="b"))
704 os.rmdir(self.do_create(pre="a", suf="b"))
705 os.rmdir(self.do_create(pre="aa", suf=".txt"))
712 os.rmdir(self.do_create(dir=d, suf=b"b"))
713 os.rmdir(self.do_create(dir=d, pre=b"a", suf=b"b"))
714 os.rmdir(self.do_create(dir=d, pre=b"aa", suf=b".txt"))
716 os.rmdir(self.do_create(dir=d, pre="aa", suf=b".txt"))
718 os.rmdir(self.do_create(dir=d, pre=b"aa", suf=".txt"))
720 os.rmdir(self.do_create(dir="", pre=b"aa", suf=b".txt"))
800 def __init__(self, dir, pre, suf): argument
801 self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf)
809 def do_create(self, pre="", suf=""): argument
810 file = self.mktemped(self.dir, pre, suf)
812 self.nameCheck(file.name, self.dir, pre, suf)
819 self.do_create(suf="b")
820 self.do_create(pre="a", suf="b")
821 self.do_create(pre="aa", suf=".txt")
844 def do_create(self, dir=None, pre="", suf="", delete=True): argument
847 file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf,
850 self.nameCheck(file.name, dir, pre, suf)
858 self.do_create(suf="b")
859 self.do_create(pre="a", suf="b")
860 self.do_create(pre="aa", suf=".txt")
970 def do_create(self, max_size=0, dir=None, pre="", suf=""): argument
973 file = tempfile.SpooledTemporaryFile(max_size=max_size, dir=dir, prefix=pre, suffix=suf)
982 f = self.do_create(max_size=100, pre="a", suf=".txt")
1301 def do_create(self, dir=None, pre="", suf="", recurse=1): argument
1304 tmp = tempfile.TemporaryDirectory(dir=dir, prefix=pre, suffix=suf)
1305 self.nameCheck(tmp.name, dir, pre, suf)
1308 d1 = self.do_create(tmp.name, pre, suf, recurse-1)