ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev1__py3-none-any.whl
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 ansys-fluent-core might be problematic. Click here for more details.
- ansys/fluent/core/__init__.py +1 -1
- ansys/fluent/core/_version.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/walk_api.py +45 -18
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +395 -390
- ansys/fluent/core/generated/solver/settings_252.py +782 -306
- ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
- ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
- ansys/fluent/core/launcher/container_launcher.py +4 -3
- ansys/fluent/core/launcher/fluent_container.py +22 -19
- ansys/fluent/core/launcher/launcher.py +2 -2
- ansys/fluent/core/launcher/pim_launcher.py +2 -2
- ansys/fluent/core/launcher/slurm_launcher.py +2 -2
- ansys/fluent/core/launcher/standalone_launcher.py +2 -2
- ansys/fluent/core/logging.py +2 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/services/app_utilities.py +2 -1
- ansys/fluent/core/services/datamodel_se.py +141 -61
- ansys/fluent/core/services/field_data.py +252 -0
- ansys/fluent/core/services/interceptors.py +28 -2
- ansys/fluent/core/session.py +7 -2
- ansys/fluent/core/session_solver.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/WHEEL +1 -1
- ansys/fluent/core/docs/README.rst +0 -155
- ansys/fluent/tests/conftest.py +0 -415
- ansys/fluent/tests/fluent_fixtures.py +0 -195
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
- ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
- ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
- ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
- ansys/fluent/tests/test_aero_session.py +0 -88
- ansys/fluent/tests/test_batch_ops.py +0 -39
- ansys/fluent/tests/test_builtin_settings.py +0 -761
- ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
- ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
- ansys/fluent/tests/test_casereader.py +0 -324
- ansys/fluent/tests/test_codegen.py +0 -783
- ansys/fluent/tests/test_creatable.py +0 -31
- ansys/fluent/tests/test_data_model_cache.py +0 -434
- ansys/fluent/tests/test_datamodel_api.py +0 -449
- ansys/fluent/tests/test_datamodel_service.py +0 -814
- ansys/fluent/tests/test_datareader.py +0 -103
- ansys/fluent/tests/test_error_handling.py +0 -24
- ansys/fluent/tests/test_events_manager.py +0 -214
- ansys/fluent/tests/test_field_data.py +0 -466
- ansys/fluent/tests/test_file_session.py +0 -355
- ansys/fluent/tests/test_file_transfer_service.py +0 -165
- ansys/fluent/tests/test_fix_doc.py +0 -29
- ansys/fluent/tests/test_flobject.py +0 -1235
- ansys/fluent/tests/test_fluent_fixes.py +0 -106
- ansys/fluent/tests/test_fluent_session.py +0 -270
- ansys/fluent/tests/test_fluent_version.py +0 -66
- ansys/fluent/tests/test_fluent_version_marker.py +0 -65
- ansys/fluent/tests/test_icing_session.py +0 -9
- ansys/fluent/tests/test_launcher.py +0 -529
- ansys/fluent/tests/test_launcher_remote.py +0 -272
- ansys/fluent/tests/test_lispy.py +0 -40
- ansys/fluent/tests/test_logging.py +0 -16
- ansys/fluent/tests/test_mapped_api.py +0 -774
- ansys/fluent/tests/test_meshing_utilities.py +0 -2436
- ansys/fluent/tests/test_meshing_workflow.py +0 -421
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
- ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
- ansys/fluent/tests/test_preferences.py +0 -89
- ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
- ansys/fluent/tests/test_reduction.py +0 -484
- ansys/fluent/tests/test_rp_vars.py +0 -77
- ansys/fluent/tests/test_scheduler.py +0 -471
- ansys/fluent/tests/test_scheme_eval_222.py +0 -338
- ansys/fluent/tests/test_scheme_eval_231.py +0 -243
- ansys/fluent/tests/test_search.py +0 -344
- ansys/fluent/tests/test_session.py +0 -594
- ansys/fluent/tests/test_settings_api.py +0 -606
- ansys/fluent/tests/test_settings_reader.py +0 -85
- ansys/fluent/tests/test_slurm_future.py +0 -67
- ansys/fluent/tests/test_solution_variables.py +0 -241
- ansys/fluent/tests/test_solver_monitors.py +0 -83
- ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
- ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
- ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
- ansys/fluent/tests/test_solvermode/test_general.py +0 -109
- ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
- ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
- ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
- ansys/fluent/tests/test_solvermode/test_models.py +0 -99
- ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
- ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
- ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
- ansys/fluent/tests/test_streaming_services.py +0 -52
- ansys/fluent/tests/test_systemcoupling.py +0 -44
- ansys/fluent/tests/test_topy.py +0 -179
- ansys/fluent/tests/test_tui_api.py +0 -70
- ansys/fluent/tests/test_type_stub.py +0 -37
- ansys/fluent/tests/test_utils.py +0 -82
- ansys/fluent/tests/util/__init__.py +0 -36
- ansys/fluent/tests/util/meshing_workflow.py +0 -33
- ansys/fluent/tests/util/solver.py +0 -72
- ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
from typing import Any, Dict
|
|
2
|
-
|
|
3
|
-
from google.protobuf.json_format import MessageToDict, ParseDict
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from ansys.api.fluent.v0.scheme_pointer_pb2 import SchemePointer
|
|
7
|
-
from ansys.fluent.core.services.scheme_eval import (
|
|
8
|
-
Symbol,
|
|
9
|
-
_convert_py_value_to_scheme_pointer,
|
|
10
|
-
_convert_scheme_pointer_to_py_value,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@pytest.mark.parametrize(
|
|
15
|
-
"py_value,json_dict",
|
|
16
|
-
[
|
|
17
|
-
(None, {}),
|
|
18
|
-
(False, {"b": False}),
|
|
19
|
-
(True, {"b": True}),
|
|
20
|
-
(5, {"fixednum": "5"}),
|
|
21
|
-
(5.0, {"flonum": 5.0}),
|
|
22
|
-
("abc", {"str": "abc"}),
|
|
23
|
-
((), {}),
|
|
24
|
-
(("abc",), {"pair": {"car": {"str": "abc"}}}),
|
|
25
|
-
(
|
|
26
|
-
("abc", 5.0),
|
|
27
|
-
{
|
|
28
|
-
"pair": {
|
|
29
|
-
"car": {"str": "abc"},
|
|
30
|
-
"cdr": {"flonum": 5.0},
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
),
|
|
34
|
-
(
|
|
35
|
-
(False, 5.0, "abc"),
|
|
36
|
-
{
|
|
37
|
-
"pair": {
|
|
38
|
-
"car": {"b": False},
|
|
39
|
-
"cdr": {
|
|
40
|
-
"pair": {
|
|
41
|
-
"car": {"flonum": 5.0},
|
|
42
|
-
"cdr": {"pair": {"car": {"str": "abc"}}},
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
),
|
|
48
|
-
([], {}),
|
|
49
|
-
(["abc"], {"pair": {"car": {"str": "abc"}}}),
|
|
50
|
-
(
|
|
51
|
-
[False, 5.0, "abc"],
|
|
52
|
-
{
|
|
53
|
-
"pair": {
|
|
54
|
-
"car": {"b": False},
|
|
55
|
-
"cdr": {
|
|
56
|
-
"pair": {
|
|
57
|
-
"car": {"flonum": 5.0},
|
|
58
|
-
"cdr": {"pair": {"car": {"str": "abc"}}},
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
),
|
|
64
|
-
({}, {}),
|
|
65
|
-
(
|
|
66
|
-
{"a": 5.0},
|
|
67
|
-
{
|
|
68
|
-
"pair": {
|
|
69
|
-
"car": {"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
),
|
|
73
|
-
(
|
|
74
|
-
{"a": 5.0, "b": 10.0},
|
|
75
|
-
{
|
|
76
|
-
"pair": {
|
|
77
|
-
"car": {"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
78
|
-
"cdr": {
|
|
79
|
-
"pair": {
|
|
80
|
-
"car": {
|
|
81
|
-
"pair": {
|
|
82
|
-
"car": {"str": "b"},
|
|
83
|
-
"cdr": {"flonum": 10.0},
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
),
|
|
91
|
-
(
|
|
92
|
-
[Symbol("+"), 2.0, 3.0],
|
|
93
|
-
{
|
|
94
|
-
"pair": {
|
|
95
|
-
"car": {"sym": "+"},
|
|
96
|
-
"cdr": {
|
|
97
|
-
"pair": {
|
|
98
|
-
"car": {"flonum": 2.0},
|
|
99
|
-
"cdr": {"pair": {"car": {"flonum": 3.0}}},
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
),
|
|
105
|
-
],
|
|
106
|
-
)
|
|
107
|
-
def test_convert_py_value_to_scheme_pointer(
|
|
108
|
-
py_value: Any, json_dict: Dict[str, Any]
|
|
109
|
-
) -> None:
|
|
110
|
-
p = SchemePointer()
|
|
111
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "22.2.0")
|
|
112
|
-
assert MessageToDict(p) == json_dict
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
@pytest.mark.parametrize(
|
|
116
|
-
"py_value,json_dict",
|
|
117
|
-
[
|
|
118
|
-
(None, {}),
|
|
119
|
-
(False, {"b": False}),
|
|
120
|
-
(True, {"b": True}),
|
|
121
|
-
(5, {"fixednum": "5"}),
|
|
122
|
-
(5.0, {"flonum": 5.0}),
|
|
123
|
-
("abc", {"str": "abc"}),
|
|
124
|
-
(["abc"], {"pair": {"car": {"str": "abc"}}}),
|
|
125
|
-
(
|
|
126
|
-
[False, 5.0, "abc"],
|
|
127
|
-
{
|
|
128
|
-
"pair": {
|
|
129
|
-
"car": {"b": False},
|
|
130
|
-
"cdr": {
|
|
131
|
-
"pair": {
|
|
132
|
-
"car": {"flonum": 5.0},
|
|
133
|
-
"cdr": {"pair": {"car": {"str": "abc"}}},
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
),
|
|
139
|
-
(None, {}),
|
|
140
|
-
(
|
|
141
|
-
{"a": 5.0, "b": 10.0},
|
|
142
|
-
{
|
|
143
|
-
"pair": {
|
|
144
|
-
"car": {"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
145
|
-
"cdr": {
|
|
146
|
-
"pair": {
|
|
147
|
-
"car": {
|
|
148
|
-
"pair": {
|
|
149
|
-
"car": {"str": "b"},
|
|
150
|
-
"cdr": {"flonum": 10.0},
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
),
|
|
158
|
-
(
|
|
159
|
-
[("a", 5.0), (5, 10.0)],
|
|
160
|
-
{
|
|
161
|
-
"pair": {
|
|
162
|
-
"car": {"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
163
|
-
"cdr": {
|
|
164
|
-
"pair": {
|
|
165
|
-
"car": {
|
|
166
|
-
"pair": {
|
|
167
|
-
"car": {"fixednum": "5"},
|
|
168
|
-
"cdr": {"flonum": 10.0},
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
),
|
|
176
|
-
(
|
|
177
|
-
{"a": [5.0, False], "b": [10.0, True]},
|
|
178
|
-
{
|
|
179
|
-
"pair": {
|
|
180
|
-
"car": {
|
|
181
|
-
"pair": {
|
|
182
|
-
"car": {"str": "a"},
|
|
183
|
-
"cdr": {
|
|
184
|
-
"pair": {
|
|
185
|
-
"car": {"flonum": 5.0},
|
|
186
|
-
"cdr": {"pair": {"car": {"b": False}}},
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"cdr": {
|
|
192
|
-
"pair": {
|
|
193
|
-
"car": {
|
|
194
|
-
"pair": {
|
|
195
|
-
"car": {"str": "b"},
|
|
196
|
-
"cdr": {
|
|
197
|
-
"pair": {
|
|
198
|
-
"car": {"flonum": 10.0},
|
|
199
|
-
"cdr": {"pair": {"car": {"b": True}}},
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
),
|
|
209
|
-
(
|
|
210
|
-
[["a", 5.0, False], [5, 10.0, True]],
|
|
211
|
-
{
|
|
212
|
-
"pair": {
|
|
213
|
-
"car": {
|
|
214
|
-
"pair": {
|
|
215
|
-
"car": {"str": "a"},
|
|
216
|
-
"cdr": {
|
|
217
|
-
"pair": {
|
|
218
|
-
"car": {"flonum": 5.0},
|
|
219
|
-
"cdr": {"pair": {"car": {"b": False}}},
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"cdr": {
|
|
225
|
-
"pair": {
|
|
226
|
-
"car": {
|
|
227
|
-
"pair": {
|
|
228
|
-
"car": {"fixednum": "5"},
|
|
229
|
-
"cdr": {
|
|
230
|
-
"pair": {
|
|
231
|
-
"car": {"flonum": 10.0},
|
|
232
|
-
"cdr": {"pair": {"car": {"b": True}}},
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
),
|
|
242
|
-
],
|
|
243
|
-
)
|
|
244
|
-
def test_convert_scheme_pointer_to_py_value(
|
|
245
|
-
py_value: Any, json_dict: Dict[str, Any]
|
|
246
|
-
) -> None:
|
|
247
|
-
p = SchemePointer()
|
|
248
|
-
ParseDict(json_dict, p)
|
|
249
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
250
|
-
assert val == py_value
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
def test_convert_scheme_pointer_having_symbol_to_py_value() -> None:
|
|
254
|
-
p = SchemePointer()
|
|
255
|
-
ParseDict(
|
|
256
|
-
{
|
|
257
|
-
"pair": {
|
|
258
|
-
"car": {"str": "abc"},
|
|
259
|
-
"cdr": {"flonum": 5.0},
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
p,
|
|
263
|
-
)
|
|
264
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
265
|
-
assert isinstance(val, tuple)
|
|
266
|
-
assert len(val) == 2
|
|
267
|
-
assert val[0] == "abc"
|
|
268
|
-
assert val[1] == 5.0
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
def test_convert_scheme_pointer_having_pair_to_py_value() -> None:
|
|
272
|
-
p = SchemePointer()
|
|
273
|
-
ParseDict(
|
|
274
|
-
{
|
|
275
|
-
"pair": {
|
|
276
|
-
"car": {"sym": "+"},
|
|
277
|
-
"cdr": {
|
|
278
|
-
"pair": {
|
|
279
|
-
"car": {"flonum": 2.0},
|
|
280
|
-
"cdr": {"pair": {"car": {"flonum": 3.0}}},
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
p,
|
|
286
|
-
)
|
|
287
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
288
|
-
assert isinstance(val, list)
|
|
289
|
-
assert isinstance(val[0], Symbol)
|
|
290
|
-
assert val[0].str == "+"
|
|
291
|
-
assert val[1:] == [2.0, 3.0]
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
@pytest.mark.parametrize(
|
|
295
|
-
"py_value",
|
|
296
|
-
[
|
|
297
|
-
None,
|
|
298
|
-
False,
|
|
299
|
-
True,
|
|
300
|
-
5,
|
|
301
|
-
5.0,
|
|
302
|
-
"abc",
|
|
303
|
-
["abc"],
|
|
304
|
-
[False, 5.0, "abc"],
|
|
305
|
-
{"abc": 5.0},
|
|
306
|
-
{"abc": 5.0, "def": [2.0, False]},
|
|
307
|
-
{"a": {"b": 3.0}},
|
|
308
|
-
{"a": {"b": {"c": 3.0}}},
|
|
309
|
-
{"a": {"b": {"c": 3.0}, "d": 4.0}},
|
|
310
|
-
],
|
|
311
|
-
)
|
|
312
|
-
def test_two_way_conversion(py_value: Any) -> None:
|
|
313
|
-
p = SchemePointer()
|
|
314
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "22.2.0")
|
|
315
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
316
|
-
assert val == py_value
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
def test_two_way_conversion_for_symbol() -> None:
|
|
320
|
-
py_value = [Symbol("+"), 2.0, 3.0]
|
|
321
|
-
p = SchemePointer()
|
|
322
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "22.2.0")
|
|
323
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
324
|
-
assert isinstance(val, list)
|
|
325
|
-
assert isinstance(val[0], Symbol)
|
|
326
|
-
assert val[0].str == "+"
|
|
327
|
-
assert val[1:] == [2.0, 3.0]
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
def test_two_way_conversion_for_pairs() -> None:
|
|
331
|
-
py_value = ("abc", 5.0)
|
|
332
|
-
p = SchemePointer()
|
|
333
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "22.2.0")
|
|
334
|
-
val = _convert_scheme_pointer_to_py_value(p, "22.2.0")
|
|
335
|
-
assert isinstance(val, tuple)
|
|
336
|
-
assert len(val) == 2
|
|
337
|
-
assert val[0] == "abc"
|
|
338
|
-
assert val[1] == 5.0
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
from typing import Any, Dict
|
|
2
|
-
|
|
3
|
-
from google.protobuf.json_format import MessageToDict, ParseDict
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from ansys.api.fluent.v0.scheme_pointer_pb2 import SchemePointer
|
|
7
|
-
from ansys.fluent.core.services.scheme_eval import (
|
|
8
|
-
Symbol,
|
|
9
|
-
_convert_py_value_to_scheme_pointer,
|
|
10
|
-
_convert_scheme_pointer_to_py_value,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@pytest.mark.parametrize(
|
|
15
|
-
"py_value,json_dict",
|
|
16
|
-
[
|
|
17
|
-
(None, {}),
|
|
18
|
-
(False, {"b": False}),
|
|
19
|
-
(True, {"b": True}),
|
|
20
|
-
(5, {"fixednum": "5"}),
|
|
21
|
-
(5.0, {"flonum": 5.0}),
|
|
22
|
-
("abc", {"str": "abc"}),
|
|
23
|
-
((), {}),
|
|
24
|
-
(("abc",), {"list": {"item": [{"str": "abc"}]}}),
|
|
25
|
-
(
|
|
26
|
-
("abc", 5.0),
|
|
27
|
-
{
|
|
28
|
-
"pair": {
|
|
29
|
-
"car": {"str": "abc"},
|
|
30
|
-
"cdr": {"flonum": 5.0},
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
),
|
|
34
|
-
(
|
|
35
|
-
(False, 5.0, "abc"),
|
|
36
|
-
{"list": {"item": [{"b": False}, {"flonum": 5.0}, {"str": "abc"}]}},
|
|
37
|
-
),
|
|
38
|
-
([], {}),
|
|
39
|
-
(["abc"], {"list": {"item": [{"str": "abc"}]}}),
|
|
40
|
-
(
|
|
41
|
-
[False, 5.0],
|
|
42
|
-
{"list": {"item": [{"b": False}, {"flonum": 5.0}]}},
|
|
43
|
-
),
|
|
44
|
-
({}, {}),
|
|
45
|
-
(
|
|
46
|
-
{"a": 5.0},
|
|
47
|
-
{
|
|
48
|
-
"list": {
|
|
49
|
-
"item": [{"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}}],
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
),
|
|
53
|
-
(
|
|
54
|
-
{"a": 5.0, "b": 10.0},
|
|
55
|
-
{
|
|
56
|
-
"list": {
|
|
57
|
-
"item": [
|
|
58
|
-
{"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
59
|
-
{"pair": {"car": {"str": "b"}, "cdr": {"flonum": 10.0}}},
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
),
|
|
64
|
-
(
|
|
65
|
-
[Symbol("+"), 2.0, 3.0],
|
|
66
|
-
{"list": {"item": [{"sym": "+"}, {"flonum": 2.0}, {"flonum": 3.0}]}},
|
|
67
|
-
),
|
|
68
|
-
],
|
|
69
|
-
)
|
|
70
|
-
def test_convert_py_value_to_scheme_pointer(
|
|
71
|
-
py_value: Any, json_dict: Dict[str, Any]
|
|
72
|
-
) -> None:
|
|
73
|
-
p = SchemePointer()
|
|
74
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "23.1.0")
|
|
75
|
-
assert MessageToDict(p) == json_dict
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@pytest.mark.parametrize(
|
|
79
|
-
"py_value,json_dict",
|
|
80
|
-
[
|
|
81
|
-
(None, {}),
|
|
82
|
-
(False, {"b": False}),
|
|
83
|
-
(True, {"b": True}),
|
|
84
|
-
(5, {"fixednum": "5"}),
|
|
85
|
-
(5.0, {"flonum": 5.0}),
|
|
86
|
-
("abc", {"str": "abc"}),
|
|
87
|
-
(["abc"], {"list": {"item": [{"str": "abc"}]}}),
|
|
88
|
-
(("abc",), {"pair": {"car": {"str": "abc"}}}),
|
|
89
|
-
(
|
|
90
|
-
[False, 5.0, "abc"],
|
|
91
|
-
{
|
|
92
|
-
"list": {"item": [{"b": False}, {"flonum": 5.0}, {"str": "abc"}]},
|
|
93
|
-
},
|
|
94
|
-
),
|
|
95
|
-
(None, {}),
|
|
96
|
-
(
|
|
97
|
-
{"a": 5.0, "b": 10.0},
|
|
98
|
-
{
|
|
99
|
-
"list": {
|
|
100
|
-
"item": [
|
|
101
|
-
{"pair": {"car": {"str": "a"}, "cdr": {"flonum": 5.0}}},
|
|
102
|
-
{"pair": {"car": {"str": "b"}, "cdr": {"flonum": 10.0}}},
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
),
|
|
107
|
-
(
|
|
108
|
-
{"a": [5.0, False], "b": [10.0, True]},
|
|
109
|
-
{
|
|
110
|
-
"list": {
|
|
111
|
-
"item": [
|
|
112
|
-
{
|
|
113
|
-
"pair": {
|
|
114
|
-
"car": {"str": "a"},
|
|
115
|
-
"cdr": {
|
|
116
|
-
"list": {
|
|
117
|
-
"item": [{"flonum": 5.0}, {"b": False}],
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"pair": {
|
|
124
|
-
"car": {"str": "b"},
|
|
125
|
-
"cdr": {
|
|
126
|
-
"list": {
|
|
127
|
-
"item": [{"flonum": 10.0}, {"b": True}],
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
),
|
|
136
|
-
(
|
|
137
|
-
[["a", 5.0, False], [5, 10.0, True]],
|
|
138
|
-
{
|
|
139
|
-
"list": {
|
|
140
|
-
"item": [
|
|
141
|
-
{
|
|
142
|
-
"list": {
|
|
143
|
-
"item": [{"str": "a"}, {"flonum": 5.0}, {"b": False}],
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"list": {
|
|
148
|
-
"item": [
|
|
149
|
-
{"fixednum": 5},
|
|
150
|
-
{"flonum": 10.0},
|
|
151
|
-
{"b": True},
|
|
152
|
-
],
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
),
|
|
159
|
-
],
|
|
160
|
-
)
|
|
161
|
-
def test_convert_scheme_pointer_to_py_value(
|
|
162
|
-
py_value: Any, json_dict: Dict[str, Any]
|
|
163
|
-
) -> None:
|
|
164
|
-
p = SchemePointer()
|
|
165
|
-
ParseDict(json_dict, p)
|
|
166
|
-
val = _convert_scheme_pointer_to_py_value(p, "23.1.0")
|
|
167
|
-
assert val == py_value
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
def test_convert_scheme_pointer_having_symbol_to_py_value() -> None:
|
|
171
|
-
p = SchemePointer()
|
|
172
|
-
ParseDict(
|
|
173
|
-
{
|
|
174
|
-
"pair": {
|
|
175
|
-
"car": {"str": "abc"},
|
|
176
|
-
"cdr": {"flonum": 5.0},
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
p,
|
|
180
|
-
)
|
|
181
|
-
val = _convert_scheme_pointer_to_py_value(p, "23.1.0")
|
|
182
|
-
assert isinstance(val, tuple)
|
|
183
|
-
assert len(val) == 2
|
|
184
|
-
assert val[0] == "abc"
|
|
185
|
-
assert val[1] == 5.0
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
@pytest.mark.parametrize(
|
|
189
|
-
"py_value",
|
|
190
|
-
[
|
|
191
|
-
None,
|
|
192
|
-
False,
|
|
193
|
-
True,
|
|
194
|
-
5,
|
|
195
|
-
5.0,
|
|
196
|
-
"abc",
|
|
197
|
-
["abc"],
|
|
198
|
-
[False, 5.0, "abc"],
|
|
199
|
-
{"abc": 5.0},
|
|
200
|
-
{"abc": 5.0, "def": [2.0, False]},
|
|
201
|
-
{"a": {"b": 3.0}},
|
|
202
|
-
{"a": {"b": {"c": 3.0}}},
|
|
203
|
-
{"a": {"b": {"c": 3.0}, "d": 4.0}},
|
|
204
|
-
],
|
|
205
|
-
)
|
|
206
|
-
def test_two_way_conversion(py_value: Any) -> None:
|
|
207
|
-
p = SchemePointer()
|
|
208
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "23.1.0")
|
|
209
|
-
val = _convert_scheme_pointer_to_py_value(p, "23.1.0")
|
|
210
|
-
assert val == py_value
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
def test_two_way_conversion_for_symbol() -> None:
|
|
214
|
-
py_value = [Symbol("+"), 2.0, 3.0]
|
|
215
|
-
p = SchemePointer()
|
|
216
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "23.1.0")
|
|
217
|
-
val = _convert_scheme_pointer_to_py_value(p, "23.1.0")
|
|
218
|
-
assert isinstance(val, list)
|
|
219
|
-
assert isinstance(val[0], Symbol)
|
|
220
|
-
assert val[0].str == "+"
|
|
221
|
-
assert val[1:] == [2.0, 3.0]
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
def test_two_way_conversion_for_pairs() -> None:
|
|
225
|
-
py_value = ("abc", 5.0)
|
|
226
|
-
p = SchemePointer()
|
|
227
|
-
_convert_py_value_to_scheme_pointer(py_value, p, "23.1.0")
|
|
228
|
-
val = _convert_scheme_pointer_to_py_value(p, "23.1.0")
|
|
229
|
-
assert isinstance(val, tuple)
|
|
230
|
-
assert len(val) == 2
|
|
231
|
-
assert val[0] == "abc"
|
|
232
|
-
assert val[1] == 5.0
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
@pytest.mark.fluent_version(">=23.1")
|
|
236
|
-
def test_long_list(new_solver_session) -> None:
|
|
237
|
-
length = 10**6
|
|
238
|
-
assert new_solver_session.scheme_eval.eval(
|
|
239
|
-
[Symbol("+")] + list(range(length))
|
|
240
|
-
) == sum(range(length))
|
|
241
|
-
assert sum(new_solver_session.scheme_eval.eval([Symbol("range"), length])) == sum(
|
|
242
|
-
range(length)
|
|
243
|
-
)
|