This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch plc4py/plc_field
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit d98d04614833dbebe698398c52a3f8435ff9c1c4
Author: Ben Hutcheson <[email protected]>
AuthorDate: Sat Apr 23 08:01:52 2022 +1000

    Updated PlcValue interface to include stub methods for get_*
---
 sandbox/plc4py/plc4py/api/value/PlcValue.py             | 6 ++++++
 sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sandbox/plc4py/plc4py/api/value/PlcValue.py 
b/sandbox/plc4py/plc4py/api/value/PlcValue.py
index 6e2bd59d4b..bded459b4f 100644
--- a/sandbox/plc4py/plc4py/api/value/PlcValue.py
+++ b/sandbox/plc4py/plc4py/api/value/PlcValue.py
@@ -28,6 +28,12 @@ T = TypeVar("T")
 class PlcValue(Generic[T], ABC):
     value: T
 
+    def get_bool(self):
+        return self.value
+
+    def get_int(self):
+        return self.value
+
 
 class PlcResponseCode(Enum):
     OK = auto()
diff --git a/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py 
b/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py
index 97c499f350..a2bb4d6920 100644
--- a/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py
+++ b/sandbox/plc4py/tests/unit/plc4py/api/test_PlcRequest.py
@@ -110,7 +110,7 @@ async def 
test_read_request_builder_non_empty_request_connected_bool(mocker) ->
     # verify that request has one field
     assert response.code == PlcResponseCode.OK
 
-    value: PlcBOOL = cast(PlcBOOL, response.values[field][0].value)
+    value = response.values[field][0].value
     assert value.get_bool()
 
 
@@ -137,7 +137,7 @@ async def 
test_read_request_builder_non_empty_request_connected_int(mocker) -> N
     # verify that request has one field
     assert response.code == PlcResponseCode.OK
 
-    value: PlcINT = cast(PlcINT, response.values[field][0].value)
+    value = response.values[field][0].value
     assert value.get_int() == 1
 
 

Reply via email to