Beispiel #1
0
 def test_read_file_content(self):
     with named_file("Content", suffix=".42") as fn:
         # valid file opens
         content = read_file_content(fn)
         self.assertEqual("Content", content)
         # invalid utf-8 file does not
         with open(fn, "wb") as f:
             f.write(b"\xc3\x28")
         content = read_file_content(fn)
         self.assertIsNone(content)
 def test_read_file_content(self):
     with named_file("Content", suffix=".42") as fn:
         # valid file opens
         content = read_file_content(fn)
         self.assertEqual("Content", content)
         # invalid utf-8 file does not
         with open(fn, "wb") as f:
             f.write(b"\xc3\x28")
         content = read_file_content(fn)
         self.assertIsNone(content)