Skip to content

Commit ddbef77

Browse files
committed
Move the new tests to the existing test function which tests files named with bytes.
1 parent 6794174 commit ddbef77

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_tempfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,7 @@ def test_basic(self):
669669
self.do_create(pre="aa", suf=".txt")
670670
self.do_create(dir=".")
671671
self.do_create(pre=f"{os.sep}myhome")
672-
self.do_create(pre=os.fsencode(f"{os.sep}home"))
673672
self.do_create(suf=f"{os.sep}home")
674-
self.do_create(suf=os.fsencode(f"{os.sep}home"))
675673

676674
def test_basic_with_bytes_names(self):
677675
# mkstemp can create files when given name parts all
@@ -682,6 +680,8 @@ def test_basic_with_bytes_names(self):
682680
self.do_create(dir=d, suf=b"b")
683681
self.do_create(dir=d, pre=b"a", suf=b"b")
684682
self.do_create(dir=d, pre=b"aa", suf=b".txt")
683+
self.do_create(dir=d, pre=os.fsencode(f"{os.sep}home"))
684+
self.do_create(dir=d, suf=os.fsencode(f"{os.sep}home"))
685685
self.do_create(dir=b".")
686686
with self.assertRaises(TypeError):
687687
self.do_create(dir=".", pre=b"aa", suf=b".txt")
@@ -768,9 +768,7 @@ def test_basic(self):
768768
os.rmdir(self.do_create(pre="a", suf="b"))
769769
os.rmdir(self.do_create(pre="aa", suf=".txt"))
770770
os.rmdir(self.do_create(pre=f"{os.sep}home"))
771-
os.rmdir(self.do_create(pre=os.fsencode(f"{os.sep}home")))
772771
os.rmdir(self.do_create(suf=f"{os.sep}home"))
773-
os.rmdir(self.do_create(suf=os.fsencode(f"{os.sep}home")))
774772

775773
def test_basic_with_bytes_names(self):
776774
# mkdtemp can create directories when given all binary parts
@@ -780,6 +778,8 @@ def test_basic_with_bytes_names(self):
780778
os.rmdir(self.do_create(dir=d, suf=b"b"))
781779
os.rmdir(self.do_create(dir=d, pre=b"a", suf=b"b"))
782780
os.rmdir(self.do_create(dir=d, pre=b"aa", suf=b".txt"))
781+
os.rmdir(self.do_create(dir=d, pre=os.fsencode(f"{os.sep}home")))
782+
os.rmdir(self.do_create(dir=d, suf=os.fsencode(f"{os.sep}home")))
783783
with self.assertRaises(TypeError):
784784
os.rmdir(self.do_create(dir=d, pre="aa", suf=b".txt"))
785785
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)