plesty.lib.test.schema_params

Helper functions for testing device schema parameter refresh workflows.

Functions

_load_schema(→ dict)

_infer_schema_type(→ str)

_serialize_value(value, inferred_type)

_write_schema(→ None)

_iter_grouped_params(schema)

Yield (group_name, command_prefix, parameters) for each group in the schema.

_resolve_schema_entry(→ dict)

Resolve a schema entry for flat and grouped schema styles.

_remove_schema_entry(→ None)

Remove a schema entry for flat and grouped schema styles.

test_real_device_refreshes_schema_defaults_and_types(→ None)

Test that a real device can refresh its schema and that defaults/types are consistent.

Module Contents

plesty.lib.test.schema_params._load_schema(p) dict
Return type:

dict

plesty.lib.test.schema_params._infer_schema_type(value) str
Return type:

str

plesty.lib.test.schema_params._serialize_value(value, inferred_type: str)
Parameters:

inferred_type (str)

plesty.lib.test.schema_params._write_schema(schema: dict, destination: pathlib.Path) None
Parameters:
  • schema (dict)

  • destination (pathlib.Path)

Return type:

None

plesty.lib.test.schema_params._iter_grouped_params(schema: dict)

Yield (group_name, command_prefix, parameters) for each group in the schema.

Parameters:

schema (dict)

plesty.lib.test.schema_params._resolve_schema_entry(schema: dict, key: str) dict

Resolve a schema entry for flat and grouped schema styles.

Supported shapes: 1. Flat/default map, including dotted keys like GroupName.ParamName. 2. Grouped map where runtime keys use group_prefix.param_key.

Parameters:
  • schema (dict)

  • key (str)

Return type:

dict

plesty.lib.test.schema_params._remove_schema_entry(schema: dict, key: str) None

Remove a schema entry for flat and grouped schema styles.

Parameters:
  • schema (dict)

  • key (str)

Return type:

None

plesty.lib.test.schema_params.test_real_device_refreshes_schema_defaults_and_types(device_cls: Any, param_schema: Any = None, *args: Any, **kwargs: Any) None

Test that a real device can refresh its schema and that defaults/types are consistent.

Parameters:
  • device_cls (Any)

  • param_schema (Any)

  • args (Any)

  • kwargs (Any)

Return type:

None