imednet.testing package

Test utilities for the iMedNet SDK.

Warning

This package provides helpers for writing tests against the SDK. Its interface is unstable and may change between minor releases. Do not rely on it in production code.

The fake_data helpers require the optional faker package:

pip install faker

Submodules

imednet.testing.fake_data module

Utility functions for generating fake API payloads.

imednet.testing.fake_data.fake_coding()[source]

Return a fake coding payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_form()[source]

Return a fake form payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_forms_for_cache(num_forms=1, study_key=None)[source]

Return a list of Form objects for caching.

Return type:

List[Form]

Parameters:
  • num_forms (int) –

  • study_key (str | None) –

imednet.testing.fake_data.fake_interval()[source]

Return a fake interval payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_job()[source]

Return a fake job payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_query()[source]

Return a fake query payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_record(schema=None)[source]

Return a fake record payload.

When schema is provided variable metadata is used to generate typed recordData values.

Return type:

Dict[str, Any]

Parameters:

schema (SchemaCache | None) –

imednet.testing.fake_data.fake_record_revision()[source]

Return a fake record revision payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_site()[source]

Return a fake site payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_study()[source]

Return a fake study payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_subject()[source]

Return a fake subject payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_user()[source]

Return a fake user payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_variable()[source]

Return a fake variable payload.

Return type:

Dict[str, Any]

imednet.testing.fake_data.fake_variables_for_cache(forms, vars_per_form=1, study_key=None)[source]

Return a list of Variable objects.

Return type:

List[Variable]

Parameters:
  • forms (List[Form]) –

  • vars_per_form (int) –

  • study_key (str | None) –

imednet.testing.fake_data.fake_visit()[source]

Return a fake visit payload.

Return type:

Dict[str, Any]

imednet.testing.typed_values module

Deterministic example values for variable types.

Used in tests and smoke scripts to exercise typed fields.

imednet.testing.typed_values.canonical_type(var_type)[source]

Return the canonical type for var_type or None if unsupported.

Return type:

Optional[str]

Parameters:

var_type (str) –

imednet.testing.typed_values.value_for(var_type)[source]

Return a deterministic example value for var_type if supported.

Return type:

Optional[Any]

Parameters:

var_type (str) –