async def test_async_only_get_created_time(directory): handler = AsyncLocalFileHandler( base_path=directory, allow_sync_methods=False ) with pytest.raises(RuntimeError) as err: handler.get_created_time(filename='test.txt') assert str(err.value) == 'Sync get_created_time method not allowed'
async def test_async_to_sync_local_file_handler_get_created_time(directory): handler = AsyncLocalFileHandler(base_path=directory) handler.save_data(filename='test.txt', data=b'contents') assert exists(directory, 'test.txt') item = handler.get_item('test.txt') ctime = handler.get_created_time('test.txt') assert ctime == datetime.fromtimestamp( os.path.getctime(handler.local_path(item)) )