Skip to content

Commit e9add85

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

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
@@ -650,9 +650,7 @@ def test_basic(self):
650650
self.do_create(pre="aa", suf=".txt")
651651
self.do_create(dir=".")
652652
self.do_create(pre=f"{os.sep}myhome")
653-
self.do_create(pre=os.fsencode(f"{os.sep}home"))
654653
self.do_create(suf=f"{os.sep}home")
655-
self.do_create(suf=os.fsencode(f"{os.sep}home"))
656654

657655
def test_basic_with_bytes_names(self):
658656
# mkstemp can create files when given name parts all
@@ -663,6 +661,8 @@ def test_basic_with_bytes_names(self):
663661
self.do_create(dir=d, suf=b"b")
664662
self.do_create(dir=d, pre=b"a", suf=b"b")
665663
self.do_create(dir=d, pre=b"aa", suf=b".txt")
664+
self.do_create(dir=d, pre=os.fsencode(f"{os.sep}home"))
665+
self.do_create(dir=d, suf=os.fsencode(f"{os.sep}home"))
666666
self.do_create(dir=b".")
667667
with self.assertRaises(TypeError):
668668
self.do_create(dir=".", pre=b"aa", suf=b".txt")
@@ -749,9 +749,7 @@ def test_basic(self):
749749
os.rmdir(self.do_create(pre="a", suf="b"))
750750
os.rmdir(self.do_create(pre="aa", suf=".txt"))
751751
os.rmdir(self.do_create(pre=f"{os.sep}home"))
752-
os.rmdir(self.do_create(pre=os.fsencode(f"{os.sep}home")))
753752
os.rmdir(self.do_create(suf=f"{os.sep}home"))
754-
os.rmdir(self.do_create(suf=os.fsencode(f"{os.sep}home")))
755753

756754
def test_basic_with_bytes_names(self):
757755
# mkdtemp can create directories when given all binary parts
@@ -761,6 +759,8 @@ def test_basic_with_bytes_names(self):
761759
os.rmdir(self.do_create(dir=d, suf=b"b"))
762760
os.rmdir(self.do_create(dir=d, pre=b"a", suf=b"b"))
763761
os.rmdir(self.do_create(dir=d, pre=b"aa", suf=b".txt"))
762+
os.rmdir(self.do_create(dir=d, pre=os.fsencode(f"{os.sep}home")))
763+
os.rmdir(self.do_create(dir=d, suf=os.fsencode(f"{os.sep}home")))
764764
with self.assertRaises(TypeError):
765765
os.rmdir(self.do_create(dir=d, pre="aa", suf=b".txt"))
766766
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)