Esempio n. 1
0
async def test_async_only_get_size(directory):
    handler = AsyncLocalFileHandler(
        base_path=directory, allow_sync_methods=False
    )

    with pytest.raises(RuntimeError) as err:
        handler.get_size(filename='test.txt')

    assert str(err.value) == 'Sync get_size method not allowed'
Esempio n. 2
0
async def test_async_to_sync_local_file_handler_get_size(directory):
    handler = AsyncLocalFileHandler(base_path=directory)
    handler.save_data(filename='test.txt', data=b'contents')
    assert exists(directory, 'test.txt')
    assert handler.get_size('test.txt') == 8