From eb78d382da41acff582e15fa913a0f78feff3740 Mon Sep 17 00:00:00 2001 From: tianyizhuang Date: Tue, 28 Apr 2026 02:54:51 +0800 Subject: [PATCH 1/2] feat(bindings/python): expose stat_with_if_modified_since, stat_with_if_unmodified_since, stat_with_version in Capability Map stat_with_if_modified_since, stat_with_if_unmodified_since, and stat_with_version from Rust core's Capability struct to the Python binding Capability class. Adds focused test verifying the new fields are accessible from Python. Co-Authored-By: Claude Sonnet 4.6 --- bindings/python/src/capability.rs | 9 +++++++ bindings/python/tests/test_stat_capability.py | 27 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 bindings/python/tests/test_stat_capability.py diff --git a/bindings/python/src/capability.rs b/bindings/python/src/capability.rs index 39c10d75c742..70371dcbf772 100644 --- a/bindings/python/src/capability.rs +++ b/bindings/python/src/capability.rs @@ -34,6 +34,12 @@ pub struct Capability { pub stat_with_if_match: bool, /// If operator supports stat with if none match. pub stat_with_if_none_match: bool, + /// If operator supports stat with if modified since. + pub stat_with_if_modified_since: bool, + /// If operator supports stat with if unmodified since. + pub stat_with_if_unmodified_since: bool, + /// If operator supports stat with version. + pub stat_with_version: bool, /// If the operator supports read operations. pub read: bool, @@ -133,6 +139,9 @@ impl Capability { stat: capability.stat, stat_with_if_match: capability.stat_with_if_match, stat_with_if_none_match: capability.stat_with_if_none_match, + stat_with_if_modified_since: capability.stat_with_if_modified_since, + stat_with_if_unmodified_since: capability.stat_with_if_unmodified_since, + stat_with_version: capability.stat_with_version, read: capability.read, read_with_if_match: capability.read_with_if_match, read_with_if_none_match: capability.read_with_if_none_match, diff --git a/bindings/python/tests/test_stat_capability.py b/bindings/python/tests/test_stat_capability.py new file mode 100644 index 000000000000..8c22abdda1ce --- /dev/null +++ b/bindings/python/tests/test_stat_capability.py @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import opendal + + +def test_stat_capability_fields_exist(): + op = opendal.Operator("memory") + cap = op.capability + + assert isinstance(cap.stat_with_if_modified_since, bool) + assert isinstance(cap.stat_with_if_unmodified_since, bool) + assert isinstance(cap.stat_with_version, bool) From 0f571df8befcb9062fc420d7308370cff2838aa1 Mon Sep 17 00:00:00 2001 From: tianyizhuang Date: Tue, 28 Apr 2026 03:10:17 +0800 Subject: [PATCH 2/2] fix(bindings/python): use capability() method call instead of property --- bindings/python/tests/test_stat_capability.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/tests/test_stat_capability.py b/bindings/python/tests/test_stat_capability.py index 8c22abdda1ce..0f13df2f4994 100644 --- a/bindings/python/tests/test_stat_capability.py +++ b/bindings/python/tests/test_stat_capability.py @@ -20,7 +20,7 @@ def test_stat_capability_fields_exist(): op = opendal.Operator("memory") - cap = op.capability + cap = op.capability() assert isinstance(cap.stat_with_if_modified_since, bool) assert isinstance(cap.stat_with_if_unmodified_since, bool)