Esempio n. 1
0
def test_is_writable():
    with open_file(iarpath, mode="r") as f:

        assert not is_writable(f)
    with open_file(iarpath, mode="a") as f:

        assert is_writable(f)
Esempio n. 2
0
def test_open_file_no_overwrite():

    with pytest.raises(FileExistsError):
        open_file(rawpath, mode="w", overwrite=False)
Esempio n. 3
0
def test_open_file_wrong_path(wrong_path: str):

    with pytest.raises(FileNotFoundError):
        open_file(wrong_path)
Esempio n. 4
0
def test_open_file_append():
    with open_file(iarpath, mode="a") as f:
        assert not f.readable()
        assert f.writable()

    assert f.closed
Esempio n. 5
0
def test_open_file_read():
    with open_file(iarpath) as f:
        assert f.readable()
        assert not f.writable()

    assert f.closed