amoghrajesh commented on code in PR #65759:
URL: https://github.com/apache/airflow/pull/65759#discussion_r3154214256


##########
shared/state/tests/state/test_state.py:
##########
@@ -0,0 +1,84 @@
+# 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.
+from __future__ import annotations
+
+import asyncio
+
+import pytest
+
+from airflow_shared.state import BaseStateBackend, StateScope, TaskScope
+
+
+class TestBaseStateBackend:
+    @pytest.fixture
+    def backend(self) -> BaseStateBackend:
+        class ConcreteBackend(BaseStateBackend):
+            def __init__(self):
+                self.calls: list[str] = []
+
+            def get(self, scope: StateScope, key: str) -> str | None:
+                self.calls.append("get")
+                return "value"
+
+            def set(self, scope: StateScope, key: str, value: str) -> None:
+                self.calls.append("set")
+
+            def delete(self, scope: StateScope, key: str) -> None:
+                self.calls.append("delete")
+
+            def clear(self, scope: StateScope) -> None:
+                self.calls.append("clear")
+
+            async def aget(self, scope: StateScope, key: str) -> str | None:
+                self.calls.append("aget")
+                return "value"
+
+            async def aset(self, scope: StateScope, key: str, value: str) -> 
None:
+                self.calls.append("aset")
+
+            async def adelete(self, scope: StateScope, key: str) -> None:
+                self.calls.append("adelete")
+
+            async def aclear(self, scope: StateScope) -> None:
+                self.calls.append("aclear")
+
+        return ConcreteBackend()
+
+    def test_aget_is_callable(self, backend):

Review Comment:
   Thank you, good catch. I replaced all four of those async callable tests 
with two tests that actually defend the contract: 
`test_incomplete_subclass_raises_type_error` (instantiating a partial 
implementation raises TypeError) and 
`test_abstract_methods_cover_full_interface` (asserts __abstractmethods__ is 
exactly the 8 expected methods).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to