77from __future__ import annotations
88
99import pytest
10- from typing import Protocol
1110
1211import appose
1312from appose import TaskException
@@ -183,7 +182,11 @@ def test_auto_proxy():
183182
184183 # Return a non-serializable object from a task - should auto-proxy
185184 # datetime is not JSON-serializable
186- dt = service .task ("import datetime\n datetime.datetime(2024, 1, 15, 10, 30, 45)" ).wait_for ().result ()
185+ dt = (
186+ service .task ("import datetime\n datetime.datetime(2024, 1, 15, 10, 30, 45)" )
187+ .wait_for ()
188+ .result ()
189+ )
187190
188191 # dt should be a proxy object now
189192 assert dt is not None
@@ -199,7 +202,8 @@ def test_auto_proxy():
199202
200203 # Access a field that returns a primitive type
201204 # Counter doesn't have simple fields, so let's create a custom class
202- custom = service .task ("""
205+ custom = (
206+ service .task ("""
203207class CustomClass:
204208 def __init__(self):
205209 self.value = 42
@@ -209,7 +213,10 @@ def get_double(self):
209213 return self.value * 2
210214
211215CustomClass()
212- """ ).wait_for ().result ()
216+ """ )
217+ .wait_for ()
218+ .result ()
219+ )
213220
214221 # Access primitive fields
215222 assert custom .value == 42
@@ -219,7 +226,8 @@ def get_double(self):
219226 assert custom .get_double () == 84
220227
221228 # Test nested object access
222- nested = service .task ("""
229+ nested = (
230+ service .task ("""
223231class Inner:
224232 def __init__(self):
225233 self.data = "inner_data"
@@ -233,7 +241,10 @@ def __init__(self):
233241 self.label = "outer"
234242
235243Outer()
236- """ ).wait_for ().result ()
244+ """ )
245+ .wait_for ()
246+ .result ()
247+ )
237248
238249 # Access nested object
239250 assert nested .label == "outer"
@@ -260,7 +271,8 @@ def test_callable_proxy():
260271 assert result == 42
261272
262273 # Create a custom callable class
263- callable_obj = service .task ("""
274+ callable_obj = (
275+ service .task ("""
264276class Adder:
265277 def __init__(self, offset):
266278 self.offset = offset
@@ -269,7 +281,10 @@ def __call__(self, x):
269281 return x + self.offset
270282
271283Adder(100)
272- """ ).wait_for ().result ()
284+ """ )
285+ .wait_for ()
286+ .result ()
287+ )
273288
274289 # Call the callable object
275290 result = callable_obj (23 )
@@ -286,7 +301,8 @@ def test_proxy_dir():
286301 maybe_debug (service )
287302
288303 # Create a custom class with known attributes
289- obj = service .task ("""
304+ obj = (
305+ service .task ("""
290306class TestClass:
291307 def __init__(self):
292308 self.field1 = 42
@@ -299,7 +315,10 @@ def method2(self, x):
299315 return x * 2
300316
301317TestClass()
302- """ ).wait_for ().result ()
318+ """ )
319+ .wait_for ()
320+ .result ()
321+ )
303322
304323 # Get dir() output
305324 attrs = dir (obj )
@@ -318,7 +337,11 @@ def method2(self, x):
318337 assert "__class__" in attrs
319338
320339 # Test with a built-in object (datetime)
321- dt = service .task ("import datetime\n datetime.datetime(2024, 1, 15)" ).wait_for ().result ()
340+ dt = (
341+ service .task ("import datetime\n datetime.datetime(2024, 1, 15)" )
342+ .wait_for ()
343+ .result ()
344+ )
322345 dt_attrs = dir (dt )
323346
324347 assert isinstance (dt_attrs , list )
0 commit comments