soia-client 1.0.9__tar.gz → 1.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of soia-client might be problematic. Click here for more details.
- {soia_client-1.0.9 → soia_client-1.0.10}/PKG-INFO +1 -1
- {soia_client-1.0.9 → soia_client-1.0.10}/pyproject.toml +1 -1
- {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/PKG-INFO +1 -1
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/arrays.py +2 -2
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/structs.py +2 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_module_initializer.py +23 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/LICENSE +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/README +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/setup.cfg +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/SOURCES.txt +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/dependency_links.txt +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soia_client.egg-info/top_level.txt +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/__init__.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/__init__.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/enums.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/function_maker.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/optionals.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/primitives.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/repr.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/impl/type_adapter.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/keyed_items.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/method.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/module_initializer.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/never.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/serializer.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/serializers.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/spec.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/soialib/timestamp.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_serializers.py +0 -0
- {soia_client-1.0.9 → soia_client-1.0.10}/tests/test_timestamp.py +0 -0
|
@@ -118,14 +118,14 @@ def _new_listuple_class() -> type:
|
|
|
118
118
|
return Listuple
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
def _new_keyed_items_class(
|
|
121
|
+
def _new_keyed_items_class(key_attributes: tuple[str, ...], default_expr: ExprLike):
|
|
122
122
|
key_items = make_function(
|
|
123
123
|
name="key_items",
|
|
124
124
|
params=["items"],
|
|
125
125
|
body=[
|
|
126
126
|
"ret = {}",
|
|
127
127
|
"for item in items:",
|
|
128
|
-
f" ret[item.{'.'.join(
|
|
128
|
+
f" ret[item.{'.'.join(key_attributes)}] = item",
|
|
129
129
|
"return ret",
|
|
130
130
|
],
|
|
131
131
|
)
|
|
@@ -294,6 +294,21 @@ class ModuleInitializerTestCase(unittest.TestCase):
|
|
|
294
294
|
),
|
|
295
295
|
),
|
|
296
296
|
),
|
|
297
|
+
spec.Struct(
|
|
298
|
+
id="my/module.soia:Rec",
|
|
299
|
+
fields=(
|
|
300
|
+
spec.Field(
|
|
301
|
+
name="r",
|
|
302
|
+
number=0,
|
|
303
|
+
type="my/module.soia:Rec",
|
|
304
|
+
),
|
|
305
|
+
spec.Field(
|
|
306
|
+
name="x",
|
|
307
|
+
number=1,
|
|
308
|
+
type=spec.PrimitiveType.INT32,
|
|
309
|
+
),
|
|
310
|
+
),
|
|
311
|
+
),
|
|
297
312
|
spec.Struct(
|
|
298
313
|
id="my/module.soia:Foobar",
|
|
299
314
|
fields=(
|
|
@@ -530,6 +545,14 @@ class ModuleInitializerTestCase(unittest.TestCase):
|
|
|
530
545
|
self.assertEqual(serializer.to_json_code(foobar), "[0,0,0,0,[2.0]]")
|
|
531
546
|
self.assertEqual(serializer.from_json_code("[0,0,0,0,[2.0]]"), foobar)
|
|
532
547
|
|
|
548
|
+
def test_recursive_struct(self):
|
|
549
|
+
rec_cls = self.init_test_module()["Rec"]
|
|
550
|
+
r = rec_cls(r=rec_cls(r=rec_cls.DEFAULT, x=1))
|
|
551
|
+
serializer = rec_cls.SERIALIZER
|
|
552
|
+
self.assertEqual(serializer.to_json_code(r), "[[[],1]]")
|
|
553
|
+
self.assertEqual(serializer.from_json_code("[[[],1]]"), r)
|
|
554
|
+
self.assertEqual(str(r), "Rec(\n r=Rec(x=1),\n)")
|
|
555
|
+
|
|
533
556
|
def test_struct_ctor_accepts_mutable_struct(self):
|
|
534
557
|
module = self.init_test_module()
|
|
535
558
|
segment_cls = module["Segment"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|