improve filehandle hygene

This commit is contained in:
Paul Gauthier 2023-07-06 12:29:49 -07:00
parent 656af5cd83
commit 0f1af1d991
2 changed files with 3 additions and 3 deletions

View file

@ -271,7 +271,7 @@ new
# Call the run method with a message
coder.run(with_message="hi")
content = open(file1, encoding="utf-8").read()
content = Path(file1).read_text(encoding="utf-8")
self.assertEqual(content, "one\nnew\nthree\n")
def test_full_edit_dry_run(self):
@ -314,7 +314,7 @@ new
# Call the run method with a message
coder.run(with_message="hi")
content = open(file1, encoding="utf-8").read()
content = Path(file1).read_text(encoding="utf-8")
self.assertEqual(content, orig_content)

View file

@ -240,7 +240,7 @@ Do this:
# Call the run method with a message
coder.run(with_message="hi")
content = open(file1, encoding="utf-8").read()
content = Path(file1).read_text(encoding="utf-8")
# check for one trailing newline
self.assertEqual(content, new_content + "\n")