Orchestrata Ultimate › Tests › Reference › scripts › test_ast_gen_serde
Tests reference — tests/scripts/test_ast_gen_serde.py
Module of tests/scripts, split out because the directory page would be too large.
Prose pending.
tests/scripts/test_ast_gen_serde.py
source · 62 tests · 895 lines
Tests for the AST tool's
gen-serdesubcommand: an emitter that generates
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_unwrap_annotation_plain |
65 | |
| function | test_unwrap_annotation_none |
70 | |
| function | test_unwrap_annotation_optional_bracket_syntax |
75 | |
| function | test_unwrap_annotation_optional_pipe_syntax |
80 | |
| function | test_unwrap_annotation_list_container |
86 | |
| function | test_unwrap_annotation_dict_container |
91 | |
| function | test_unwrap_annotation_optional_list |
96 | |
| function | test_unwrap_annotation_ambiguous_union_is_plain |
105 | A union with no None member (or more than one non-None member) is |
| function | test_classify_element_datetime_and_date |
118 | |
| function | test_classify_element_none_is_plain |
126 | |
| function | test_classify_element_enum_via_lookup |
131 | |
| function | test_classify_element_dataclass_via_lookup |
137 | |
| function | test_classify_element_known_class_without_serde_is_plain |
148 | A known local class that is neither an Enum nor a to_dict/from_dict |
| function | test_classify_element_unknown_name_is_plain |
156 | |
| function | test_default_fallback_no_default_uses_sensible_defaults |
166 | |
| function | test_default_fallback_literal_default_passthrough |
173 | |
| function | test_default_fallback_field_default_factory_unwraps_to_call |
179 | field(default_factory=_utc_now) unwraps to _utc_now() — matching |
| function | test_default_fallback_field_default_factory_lambda_is_parenthesized |
188 | A factory more complex than a bare name (e.g. a lambda with its own |
| function | test_default_fallback_field_default_kwarg_unwraps |
200 | |
| function | test_default_fallback_dataclasses_field_qualified |
205 | |
| function | test_default_fallback_unparseable_default_passthrough |
213 | A default that isn't valid Python on its own (defensive) is passed |
| function | test_to_dict_field_expr_plain_never_guarded |
225 | |
| function | test_to_dict_field_expr_datetime_required_and_optional |
232 | |
| function | test_to_dict_field_expr_enum |
244 | |
| function | test_to_dict_field_expr_dataclass_optional |
251 | |
| function | test_to_dict_field_expr_list_of_dataclass |
258 | |
| function | test_to_dict_field_expr_dict_of_enum |
265 | |
| function | test_to_dict_field_expr_list_of_datetime |
272 | |
| function | test_to_dict_field_expr_plain_container_passthrough |
279 | dict[str, Any]/list[str] of plain values pass straight through — no |
| function | test_from_dict_field_expr_plain |
289 | |
| function | test_from_dict_field_expr_datetime_uses_fallback |
296 | |
| function | test_from_dict_field_expr_enum |
307 | |
| function | test_from_dict_field_expr_dataclass_required_vs_optional |
313 | |
| function | test_from_dict_field_expr_list_of_dataclass |
325 | |
| function | test_from_dict_field_expr_plain_container_passthrough |
333 | |
| function | test_from_dict_field_expr_list_of_datetime |
339 | |
| function | test_from_dict_field_expr_dict_of_enum |
349 | |
| function | test_generate_serde_missing_class_returns_none |
360 | |
| function | test_generate_serde_type_aware_transforms_and_compiles |
366 | Plain, datetime, Enum, and nested-dataclass fields each get the |
| function | test_generate_serde_round_trips_all_field_kinds |
411 | Splice the generated methods back into the real class and exec the |
| function | test_returns_in_skips_nested_function_scope |
473 | A return inside a helper function nested in to_dict must NOT be |
| function | test_to_dict_keys_none_for_dynamic_dict_key |
491 | A dict key that isn't a string literal (e.g. computed) can't be |
| function | test_from_dict_kwargs_none_for_positional_args |
501 | A constructor call using positional args can't be matched to field |
| function | test_from_dict_kwargs_none_for_kwargs_expansion |
516 | cls(**data) could cover any field through the expansion — can't be |
| function | test_check_serde_drift_flags_field_missing_from_to_dict |
536 | |
| function | test_check_serde_drift_flags_field_missing_from_from_dict |
558 | |
| function | test_check_serde_drift_complete_class_no_drift |
578 | |
| function | test_check_serde_drift_ignores_keyword_avoidance_rename |
600 | A field serialized under a DIFFERENT dict key (e.g. from_ -> "from" |
| function | test_check_serde_drift_respects_serde_exclude_marker |
625 | A field listed in __serde_exclude__ is a deliberate omission (e.g. a |
| function | test_check_serde_drift_dynamic_from_dict_is_unverifiable_not_drift |
649 | from_dict returning a locally-built variable (not a direct call) is |
| function | test_check_serde_drift_dynamic_to_dict_is_unverifiable_not_drift |
675 | to_dict returning a locally-built dict variable (not a literal dict |
| function | test_check_serde_drift_skips_class_without_from_dict |
699 | A class with only to_dict (no from_dict) is simply out of |
| function | test_check_serde_drift_skips_non_dataclass_classes |
717 | A plain class (not @dataclass) with to_dict/from_dict is out of |
| function | test_check_serde_drift_class_name_filter |
734 | Passing a class name restricts the scan to just that class, even when |
| function | test_check_serde_drift_against_real_agents_types_module |
765 | The real hand-written TaskDefinition/VolkInstance serde pairs in |
| function | test_cli_gen_serde_emits_code |
804 | |
| function | test_cli_gen_serde_missing_class_exits_two |
819 | |
| function | test_cli_gen_serde_no_name_no_check_exits_two |
826 | |
| function | test_cli_gen_serde_check_max_ratchet_exit_codes |
832 | --max N exits non-zero only when the drift count EXCEEDS N (mirrors |
| function | test_cli_gen_serde_check_all_classes_no_name |
856 | |
| function | test_cli_gen_serde_check_missing_named_class_exits_two |
875 | |
| function | test_cli_gen_serde_output_flag_writes_file |
882 |