コード例 #1
0
def test_latin_one_undeclared(tmp_path):
    file = tmp_path / "tmp"
    file.write_bytes("I am some latin 1 Â encoded text".encode("latin1"))

    contents = Snippet.load_contents(str(file))
    assert contents == "I am some latin 1 Â encoded text"
コード例 #2
0
 def test_latin_one_undeclared(self):
     with tempfile.NamedTemporaryFile() as temp:
         temp.write("I am some latin 1 Â encoded text".encode("latin1"))
         temp.flush()
         contents = Snippet.load_contents(temp.name)
     self.assertEqual(contents, "I am some latin 1 Â encoded text")