Xuanwo commented on code in PR #6086:
URL: https://github.com/apache/opendal/pull/6086#discussion_r2122535779


##########
bindings/python/tests/test_write.py:
##########
@@ -176,6 +176,24 @@ async def test_async_writer(service_name, operator, 
async_operator):
         await async_operator.stat(filename)
 
 
+@pytest.mark.asyncio
+@pytest.mark.need_capability("write", "delete", "write_with_if_not_exists")
+async def test_async_writer_options(service_name, operator, async_operator):
+    size = randint(1, 1024)
+    filename = f"test_file_{str(uuid4())}.txt"
+    content = os.urandom(size)
+    f = await async_operator.open(filename, "wb")
+    written_bytes = await f.write(content)
+    assert written_bytes == size
+    await f.close()
+
+    with pytest.raises(Exception)as excinfo:
+        async with await async_operator.open(filename, "wb", 
if_not_exists=True) as w:
+            w.write(content)
+        assert "ConditionNotMatch" in str(excinfo.value)

Review Comment:
   related discussion: https://github.com/apache/opendal/issues/6235



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to