Skip to content

Commit 738444f

Browse files
committed
refactor: use with-statements
The explicit open/close was to keep Jython working in 2017, which we no longer need to do.
1 parent 98a0cea commit 738444f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_process.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,9 +1393,9 @@ def make_main_and_sub(self) -> None:
13931393
self.make_file(
13941394
"sub.py",
13951395
"""\
1396-
f = open("out.txt", "w", encoding="utf-8")
1397-
f.write("Hello, world!\\n")
1398-
f.close()
1396+
with open("out.txt", "w", encoding="utf-8") as f:
1397+
f.write("Hello, world!\\n")
1398+
a = 3
13991399
""",
14001400
)
14011401

@@ -1763,9 +1763,9 @@ def path(basename: str) -> str:
17631763
self.make_file(
17641764
path("sub.py"),
17651765
"""\
1766-
f = open("out.txt", "w", encoding="utf-8")
1767-
f.write("Hello, world!")
1768-
f.close()
1766+
with open("out.txt", "w", encoding="utf-8") as f:
1767+
f.write("Hello, world!")
1768+
a = 3
17691769
""",
17701770
)
17711771
self.make_file(

0 commit comments

Comments
 (0)