ansys-fluent-core 0.28.2__py3-none-any.whl → 0.29.0__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.

Files changed (221) hide show
  1. ansys/fluent/core/__init__.py +26 -1
  2. ansys/fluent/core/_stand_alone_datamodel_client/_datamodel_client.py +22 -0
  3. ansys/fluent/core/_version.py +24 -2
  4. ansys/fluent/core/codegen/__init__.py +22 -0
  5. ansys/fluent/core/codegen/allapigen.py +38 -5
  6. ansys/fluent/core/codegen/builtin_settingsgen.py +22 -0
  7. ansys/fluent/core/codegen/data/__init__.py +21 -0
  8. ansys/fluent/core/codegen/data/fluent_gui_help_patch.py +22 -0
  9. ansys/fluent/core/codegen/data/meshing_utilities_examples.py +22 -0
  10. ansys/fluent/core/codegen/datamodelgen.py +40 -4
  11. ansys/fluent/core/codegen/print_fluent_version.py +22 -0
  12. ansys/fluent/core/codegen/settingsgen.py +67 -4
  13. ansys/fluent/core/codegen/tuigen.py +44 -6
  14. ansys/fluent/core/codegen/walk_api.py +67 -18
  15. ansys/fluent/core/codegen/write_settings_yaml.py +22 -0
  16. ansys/fluent/core/data_model_cache.py +22 -0
  17. ansys/fluent/core/examples/__init__.py +22 -0
  18. ansys/fluent/core/examples/downloads.py +22 -0
  19. ansys/fluent/core/exceptions.py +22 -0
  20. ansys/fluent/core/file_session.py +22 -0
  21. ansys/fluent/core/filereader/__init__.py +21 -0
  22. ansys/fluent/core/filereader/case_file.py +22 -0
  23. ansys/fluent/core/filereader/casereader.py +22 -0
  24. ansys/fluent/core/filereader/data_file.py +22 -0
  25. ansys/fluent/core/filereader/lispy.py +22 -0
  26. ansys/fluent/core/fluent_connection.py +23 -1
  27. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  28. ansys/fluent/core/generated/datamodel_252/meshing.py +32 -0
  29. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  30. ansys/fluent/core/generated/solver/settings_222.py +0 -72
  31. ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
  32. ansys/fluent/core/generated/solver/settings_231.py +0 -574
  33. ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
  34. ansys/fluent/core/generated/solver/settings_232.py +0 -527
  35. ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
  36. ansys/fluent/core/generated/solver/settings_241.py +0 -478
  37. ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
  38. ansys/fluent/core/generated/solver/settings_242.py +0 -361
  39. ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
  40. ansys/fluent/core/generated/solver/settings_251.py +0 -399
  41. ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
  42. ansys/fluent/core/generated/solver/settings_252.py +7794 -4185
  43. ansys/fluent/core/generated/solver/settings_252.pyi +6986 -3213
  44. ansys/fluent/core/generated/solver/tui_252.py +537 -181
  45. ansys/fluent/core/get_build_details.py +22 -0
  46. ansys/fluent/core/journaling.py +38 -0
  47. ansys/fluent/core/launcher/__init__.py +22 -0
  48. ansys/fluent/core/launcher/container_launcher.py +65 -56
  49. ansys/fluent/core/launcher/error_handler.py +30 -0
  50. ansys/fluent/core/launcher/fluent_container.py +45 -20
  51. ansys/fluent/core/launcher/launcher.py +53 -5
  52. ansys/fluent/core/launcher/launcher_utils.py +22 -0
  53. ansys/fluent/core/launcher/pim_launcher.py +120 -86
  54. ansys/fluent/core/launcher/process_launch_string.py +22 -0
  55. ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
  56. ansys/fluent/core/launcher/server_info.py +45 -3
  57. ansys/fluent/core/launcher/slurm_launcher.py +25 -3
  58. ansys/fluent/core/launcher/standalone_launcher.py +68 -63
  59. ansys/fluent/core/launcher/watchdog.py +22 -0
  60. ansys/fluent/core/logging.py +24 -0
  61. ansys/fluent/core/logging_config.yaml +3 -0
  62. ansys/fluent/core/meshing/meshing_workflow.py +22 -0
  63. ansys/fluent/core/parametric.py +22 -0
  64. ansys/fluent/core/post_objects/__init__.py +21 -0
  65. ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
  66. ansys/fluent/core/post_objects/meta.py +22 -0
  67. ansys/fluent/core/post_objects/post_helper.py +22 -0
  68. ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
  69. ansys/fluent/core/post_objects/post_objects_container.py +22 -0
  70. ansys/fluent/core/post_objects/singleton_meta.py +22 -0
  71. ansys/fluent/core/post_objects/timing_decorator.py +22 -0
  72. ansys/fluent/core/report.py +77 -0
  73. ansys/fluent/core/rpvars.py +22 -0
  74. ansys/fluent/core/scheduler/__init__.py +22 -0
  75. ansys/fluent/core/scheduler/load_machines.py +22 -0
  76. ansys/fluent/core/scheduler/machine_list.py +22 -0
  77. ansys/fluent/core/search.py +22 -0
  78. ansys/fluent/core/services/__init__.py +22 -0
  79. ansys/fluent/core/services/api_upgrade.py +22 -0
  80. ansys/fluent/core/services/app_utilities.py +38 -0
  81. ansys/fluent/core/services/batch_ops.py +22 -0
  82. ansys/fluent/core/services/datamodel_se.py +26 -1
  83. ansys/fluent/core/services/datamodel_tui.py +22 -0
  84. ansys/fluent/core/services/deprecated_field_data.py +23 -1
  85. ansys/fluent/core/services/events.py +22 -0
  86. ansys/fluent/core/services/field_data.py +285 -2
  87. ansys/fluent/core/services/health_check.py +22 -0
  88. ansys/fluent/core/services/interceptors.py +50 -2
  89. ansys/fluent/core/services/monitor.py +22 -0
  90. ansys/fluent/core/services/reduction.py +22 -0
  91. ansys/fluent/core/services/scheme_eval.py +22 -0
  92. ansys/fluent/core/services/settings.py +22 -0
  93. ansys/fluent/core/services/solution_variables.py +22 -0
  94. ansys/fluent/core/services/streaming.py +22 -0
  95. ansys/fluent/core/services/transcript.py +22 -0
  96. ansys/fluent/core/session.py +39 -2
  97. ansys/fluent/core/session_base_meshing.py +22 -0
  98. ansys/fluent/core/session_meshing.py +22 -0
  99. ansys/fluent/core/session_meshing.pyi +22 -0
  100. ansys/fluent/core/session_pure_meshing.py +22 -0
  101. ansys/fluent/core/session_pure_meshing.pyi +22 -0
  102. ansys/fluent/core/session_shared.py +22 -0
  103. ansys/fluent/core/session_solver.py +43 -0
  104. ansys/fluent/core/session_solver.pyi +22 -0
  105. ansys/fluent/core/session_solver_aero.py +22 -0
  106. ansys/fluent/core/session_solver_icing.py +22 -0
  107. ansys/fluent/core/session_solver_lite.py +22 -0
  108. ansys/fluent/core/solver/__init__.py +22 -0
  109. ansys/fluent/core/solver/error_message.py +22 -0
  110. ansys/fluent/core/solver/flobject.py +22 -0
  111. ansys/fluent/core/solver/flunits.py +22 -0
  112. ansys/fluent/core/solver/function/__init__.py +22 -0
  113. ansys/fluent/core/solver/function/reduction.py +22 -0
  114. ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
  115. ansys/fluent/core/solver/settings_builtin_data.py +22 -0
  116. ansys/fluent/core/solver/settings_external.py +22 -0
  117. ansys/fluent/core/streaming_services/__init__.py +21 -0
  118. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +22 -0
  119. ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
  120. ansys/fluent/core/streaming_services/events_streaming.py +22 -0
  121. ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
  122. ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
  123. ansys/fluent/core/streaming_services/streaming.py +22 -0
  124. ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
  125. ansys/fluent/core/systemcoupling.py +22 -0
  126. ansys/fluent/core/utils/__init__.py +22 -0
  127. ansys/fluent/core/utils/data_transfer.py +22 -0
  128. ansys/fluent/core/utils/deprecate.py +24 -1
  129. ansys/fluent/core/utils/dictionary_operations.py +22 -0
  130. ansys/fluent/core/utils/dump_session_data.py +22 -0
  131. ansys/fluent/core/utils/event_loop.py +22 -0
  132. ansys/fluent/core/utils/execution.py +22 -0
  133. ansys/fluent/core/utils/file_transfer_service.py +22 -0
  134. ansys/fluent/core/utils/fix_doc.py +22 -0
  135. ansys/fluent/core/utils/fldoc.py +22 -0
  136. ansys/fluent/core/utils/fluent_version.py +22 -0
  137. ansys/fluent/core/utils/networking.py +22 -0
  138. ansys/fluent/core/utils/setup_for_fluent.py +22 -0
  139. ansys/fluent/core/warnings.py +22 -0
  140. ansys/fluent/core/workflow.py +22 -0
  141. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/LICENSE +8 -8
  142. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/METADATA +56 -33
  143. ansys_fluent_core-0.29.0.dist-info/RECORD +219 -0
  144. {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/WHEEL +1 -1
  145. ansys/fluent/core/docs/README.rst +0 -155
  146. ansys/fluent/tests/conftest.py +0 -415
  147. ansys/fluent/tests/fluent_fixtures.py +0 -195
  148. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  149. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  150. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  151. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  152. ansys/fluent/tests/test_aero_session.py +0 -88
  153. ansys/fluent/tests/test_batch_ops.py +0 -39
  154. ansys/fluent/tests/test_builtin_settings.py +0 -761
  155. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  156. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  157. ansys/fluent/tests/test_casereader.py +0 -324
  158. ansys/fluent/tests/test_codegen.py +0 -783
  159. ansys/fluent/tests/test_creatable.py +0 -31
  160. ansys/fluent/tests/test_data_model_cache.py +0 -434
  161. ansys/fluent/tests/test_datamodel_api.py +0 -429
  162. ansys/fluent/tests/test_datamodel_service.py +0 -814
  163. ansys/fluent/tests/test_datareader.py +0 -103
  164. ansys/fluent/tests/test_error_handling.py +0 -24
  165. ansys/fluent/tests/test_events_manager.py +0 -214
  166. ansys/fluent/tests/test_field_data.py +0 -466
  167. ansys/fluent/tests/test_file_session.py +0 -355
  168. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  169. ansys/fluent/tests/test_fix_doc.py +0 -29
  170. ansys/fluent/tests/test_flobject.py +0 -1235
  171. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  172. ansys/fluent/tests/test_fluent_session.py +0 -270
  173. ansys/fluent/tests/test_fluent_version.py +0 -66
  174. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  175. ansys/fluent/tests/test_icing_session.py +0 -9
  176. ansys/fluent/tests/test_launcher.py +0 -529
  177. ansys/fluent/tests/test_launcher_remote.py +0 -272
  178. ansys/fluent/tests/test_lispy.py +0 -40
  179. ansys/fluent/tests/test_logging.py +0 -16
  180. ansys/fluent/tests/test_mapped_api.py +0 -766
  181. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  182. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  183. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  184. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  185. ansys/fluent/tests/test_preferences.py +0 -89
  186. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  187. ansys/fluent/tests/test_reduction.py +0 -484
  188. ansys/fluent/tests/test_rp_vars.py +0 -77
  189. ansys/fluent/tests/test_scheduler.py +0 -471
  190. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  191. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  192. ansys/fluent/tests/test_search.py +0 -344
  193. ansys/fluent/tests/test_session.py +0 -594
  194. ansys/fluent/tests/test_settings_api.py +0 -606
  195. ansys/fluent/tests/test_settings_reader.py +0 -85
  196. ansys/fluent/tests/test_slurm_future.py +0 -67
  197. ansys/fluent/tests/test_solution_variables.py +0 -241
  198. ansys/fluent/tests/test_solver_monitors.py +0 -83
  199. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  200. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  201. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  202. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  203. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  204. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  205. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  206. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  207. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  208. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  209. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  210. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  211. ansys/fluent/tests/test_streaming_services.py +0 -52
  212. ansys/fluent/tests/test_systemcoupling.py +0 -44
  213. ansys/fluent/tests/test_topy.py +0 -179
  214. ansys/fluent/tests/test_tui_api.py +0 -70
  215. ansys/fluent/tests/test_type_stub.py +0 -37
  216. ansys/fluent/tests/test_utils.py +0 -82
  217. ansys/fluent/tests/util/__init__.py +0 -36
  218. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  219. ansys/fluent/tests/util/solver.py +0 -72
  220. ansys_fluent_core-0.28.2.dist-info/AUTHORS +0 -12
  221. ansys_fluent_core-0.28.2.dist-info/RECORD +0 -294
@@ -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
- )