| 887 | self.assertEqual(f.read(), 'bbbzzz'.encode(charset)) |
| 888 | |
| 889 | def test_seek_append_bom(self): |
| 890 | # Same test, but first seek to the start and then to the end |
| 891 | filename = os_helper.TESTFN |
| 892 | for charset in ('utf-8-sig', 'utf-16', 'utf-32'): |
| 893 | with self.open(filename, 'w', encoding=charset) as f: |
| 894 | f.write('aaa') |
| 895 | with self.open(filename, 'a', encoding=charset) as f: |
| 896 | f.seek(0) |
| 897 | f.seek(0, self.SEEK_END) |
| 898 | f.write('xxx') |
| 899 | with self.open(filename, 'rb') as f: |
| 900 | self.assertEqual(f.read(), 'aaaxxx'.encode(charset)) |
| 901 | |
| 902 | def test_errors_property(self): |
| 903 | with self.open(os_helper.TESTFN, "w", encoding="utf-8") as f: |