Пример #1
0
def test_sponge_that_on_exception_file_isnt_modified():
    with scoped_curdir():
        open('foo', 'w').write('bar')
        try:
            with _sponge('foo') as f:
                f.write('hello')
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open('foo').read() == 'bar'
Пример #2
0
def test_sponge_that_on_exception_file_isnt_modified():
    with _directory_sandbox():
        open("foo", "w").write("bar")
        try:
            with _sponge("foo") as f:
                f.write("hello")
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open("foo").read() == "bar"
Пример #3
0
def test_sponge_that_on_exception_file_isnt_modified():
    with scoped_curdir():
        open('foo', 'w').write('bar')
        try:
            with _sponge('foo') as f:
                f.write('hello')
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open('foo').read() == 'bar'
Пример #4
0
def test_sponge_that_new_data_end_up_in_file():
    with _directory_sandbox():
        with _sponge("hello") as f:
            f.write("hello")
        assert open("hello").read() == "hello"
Пример #5
0
def test_sponge_that_new_data_end_up_in_file():
    with scoped_curdir():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'
Пример #6
0
def test_sponge_that_new_data_end_up_in_file():
    with scoped_curdir():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'
Пример #7
0
def test_sponge_that_new_data_end_up_in_file():
    with _directory_sandbox():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'