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.

Submodules

imednet.testing.data_generator module

Internal utility for generating synthetic data without external dependencies.

class imednet.testing.data_generator.RandomDataGenerator[source]

Bases: object

A deterministic, standard-library based data generator replacement for Faker.

__init__(seed=None)[source]

Return a mocked value.

Parameters:

seed (int | None) –

Return type:

None

boolean()[source]

Return a mocked value.

Return type:

bool

bothify(text)[source]

Return a mocked value.

Return type:

str

Parameters:

text (str) –

company()[source]

Return a mocked value.

Return type:

str

date_time()[source]

Return a mocked value.

Return type:

datetime

email()[source]

Return a mocked value.

Return type:

str

first_name()[source]

Return a mocked value.

Return type:

str

last_name()[source]

Return a mocked value.

Return type:

str

lexify(text)[source]

Return a mocked value.

Return type:

str

Parameters:

text (str) –

paragraph(nb_sentences=3)[source]

Return a mocked value.

Return type:

str

Parameters:

nb_sentences (int) –

pyfloat(left_digits=2, right_digits=2, positive=True)[source]

Return a mocked value.

Return type:

float

Parameters:
  • left_digits (int) –

  • right_digits (int) –

  • positive (bool) –

random_element(elements)[source]

Return a mocked value.

Return type:

Any

Parameters:

elements (list[Any]) –

random_int(min=0, max=9999)[source]

Return a mocked value.

Return type:

int

Parameters:
  • min (int) –

  • max (int) –

sentence(nb_words=3)[source]

Return a mocked value.

Return type:

str

Parameters:

nb_words (int) –

user_name()[source]

Return a mocked value.

Return type:

str

uuid4()[source]

Return a mocked value.

Return type:

str

word()[source]

Return a mocked value.

Return type:

str

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:
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) –