Closed
Description
Seems it's a lack in the API:
# pytest
def test_thinks_is_a_large_file(fs):
fs.create_file("/tmp/file.txt", contents=None)
with open("/tmp/file.txt", 'rt') as ff:
ff.read()
If the contents is None
there is no chance to later read the file.
In my opinion None
in this API should be equivalent to ""
- giving an empty file. However at read attempt it raises:
self = <pyfakefs.fake_filesystem.FakeFileWrapper object at 0x7f5a8c6dd310>
name = 'read'
def __getattr__(self, name):
if self.file_object.is_large_file():
> raise FakeLargeFileIoException(self._file_path)
E FakeLargeFileIoException: Read and write operations not supported for fake large file: /tmp/file.txt
Of course setting contents=''
works OK.