We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0c988d commit ad8e7bbCopy full SHA for ad8e7bb
fluent.runtime/tests/test_utils.py
@@ -27,13 +27,13 @@ def patch_me(a, b):
27
def assertFileIs(self, filename, expect_contents):
28
"""
29
expect_contents is None: Expect file does not exist
30
- expect_contents is a str: Expect file contents to match
+ expect_contents is a str: Expect file to exist and contents to match
31
32
if expect_contents is None:
33
self.assertFalse(os.path.isfile(filename),
34
f"Expected {filename} to not exist.")
35
else:
36
self.assertTrue(os.path.isfile(filename),
37
f"Expected {filename} to exist.")
38
- self.assertEqual(codecs.open(filename, "r", "utf-8").read(),
39
- expect_contents)
+ with codecs.open(filename, "r", "utf-8") as f:
+ self.assertEqual(f.read(), expect_contents)
0 commit comments