def test_custom_encoding_text(self):
test_file = self.test_dir / 'test_file.txt'
with stor.open(test_file, mode='w', encoding='utf-16') as fp:
fp.write(STRING_STRING)
with stor.open(test_file, mode='r', encoding='utf-16') as fp:
result = fp.read()
assert result == STRING_STRING
with pytest.raises(UnicodeDecodeError):
with stor.open(test_file, mode='r', encoding='utf-8') as fp:
result = fp.read()
评论列表
文章目录