open.py 329 B

1234567891011
  1. import pytest
  2. class AbstractOpenTests:
  3. def test_open_exclusive(self, fs, fs_target):
  4. with fs.open(fs_target, "wb") as f:
  5. f.write(b"data")
  6. with fs.open(fs_target, "rb") as f:
  7. assert f.read() == b"data"
  8. with pytest.raises(FileExistsError):
  9. fs.open(fs_target, "xb")