pytest tests.model.datapoint_fixtures

tests.model.datapoints_fixtures.blood_glucose_data()

Uses the make_metric function to assemble a list data for the biometrics_tracker.model.datapoints.BloodGlucose class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.blood_glucose_data_fix()

A pytest.fixture wrapper for blood_glucose_data()

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.blood_glucose_dp_data_fix()

Uses the make_datapoint function to assemble a list data for the biometrics_tracker.model.datapoints.BloodGlucoseDP class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.blood_pressure_data()

Uses the make_metric function to assemble a list data for the biometrics_tracker.model.datapoints.BloodPressure class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.blood_pressure_data_fix()

A pytest.fixture wrapper for blood_pressure_data()

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.blood_pressure_dp_data_fix()

Uses the make_datapoint function to assemble a list data for the biometrics_tracker.model.datapoints.BloodPressureDP class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_temp_data() list[collections.namedtuple]

Uses the make_metric function to assemble a list data for the biometrics_tracker.model.datapoints.BodyTemp class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_temp_data_fix() list[collections.namedtuple]

A pytest.fixture wrapper for body_temp_data()

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_temp_dp_data_fix() list[collections.namedtuple]

Uses the make_datapoint function to assemble a list data for the biometrics_tracker.model.datapoints.BodyTemperatureDP class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_weight_data() list[collections.namedtuple]

Uses the make_metric function to assemble a list data for the biometrics_tracker.model.datapoints.BodyWeight class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_weight_data_fix() list[collections.namedtuple]

A pytest.fixture wrapper for body_weight_data()

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.body_weight_dp_data_fix() list[collections.namedtuple]

Uses the make_datapoint function to assemble a list data for the biometrics_tracker.model.datapoints.BodyWeightDP class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.datapoints_fix(people_fix, blood_pressure_dp_data_fix, pulse_dp_data_fix, blood_glucose_dp_data_fix, body_temp_dp_data_fix, body_weight_dp_data_fix) list[biometrics_tracker.model.datapoints.DataPoint]

A pytest.fixture that provides a varied list of DataPoint subclass instances using rondom data

Parameters
  • people_fix – a pytest.fixture providing Person instances

  • blood_pressure_dp_data_fix – a pytest.fixture providing data to create BloodPressureDP instances

  • pulse_dp_data_fix – a pytest.fixture providing data to create PulseDP instances

  • blood_glucose_dp_data_fix – a pytest.fixture providing data to crate BloodGlucoseDP instances

  • body_temp_dp_data_fix – a pytest.fixture providing data to create BodyTemperature instances

  • body_weight_dp_data_fix – a pytest.fixture providing data to create BodyWeight instances

Returns

a list of DataPoint subclasses

Return type

list[biometrics_tracking.model.datapoints.DataPoint]

tests.model.datapoints_fixtures.make_datapoint(person_id: str, taken_lower: datetime, taken_upper: datetime, note: str, dp_type: DataPointType, data: Union[BloodGlucose, BloodPressure, Pulse, BodyTemperature, BodyWeight])

Creates named tuple of data necessary to create an instance of one of the DataPoint classes (e.g. BloodPressureDP, BloodGlucoseDP, etc.) using random values within the specified ranges

Parameters
  • person_id (str) – the Person ID to be associated with the DataPoint data

  • taken_lower (datetime) – a lower limit for the Taken datetime property

  • taken_upper (datetime) – an upper limit for the Taken datetime property

  • note (str) – a note to be associated with the DataPoint data

  • dp_type (biometrics_tracker.model.datapoints.DataPointType) – the DataPointType to be associated with the DataPoint data

  • data – an instance the metric class associated with the DataPointType

Type

metric_union

Returns

a named tuple containing the data to create an instance of one of the DataPoint classes

Return type

collections.namedtuple(‘bg_dp_data_t’, [‘person_id’, ‘taken’, ‘note’, ‘data’, ‘type’])

tests.model.datapoints_fixtures.make_metric(value_lower: Union[int, Decimal], value_upper: Union[int, Decimal], dp_type: DataPointType, precision: int = 2) namedtuple

Creates named tuple of data necessary to create an instance of one of the metrics classes (e.g. BloodPressure, BloodGlucose, etc.) using random values within the specified ranges

Parameters
  • value_lower (Union[int, decimal.Decimal]) – a lower limit for the random metric value

  • value_upper (Union[int, decimal.Decimal]) – a upper limit for the random metric value

  • dp_type – the DataPointType for the metric

  • precision – for Decimal values, the number of places to the right of the decimal point

Returns

a named tuple of properties to create an instance of one of the metrics classes

Return type

collections.namedtuple(‘bg_data_t’, [‘value’, ‘uom’])

tests.model.datapoints_fixtures.people()

Creates a list of biometrics_tracker.model.datapoints.Person instances using randomized data. The created instances are placed in a dict keyed by ID to prevent the creation of Person instances with duplicated IDs

Returns

dict.values() containing the biometrics_tracker.model.datapoints.Person instances

tests.model.datapoints_fixtures.people_fix()

A pytest.fixture wrapper for people()

Returns

dict.values() containing the biometrics_tracker.model.datapoints.Person instances

tests.model.datapoints_fixtures.person(person_data_fix) Person
Parameters

person_data_fix (pytest.fixture) – a pytest.fixture providing the data to create a biometrics_tracker.model.datapoints.Person instance

Returns

a Person instance created from randomized data

Return type

biometrics_tracker.model.datapoints.Person

tests.model.datapoints_fixtures.person_data()
Returns

a named tuple containing the properties needed to create a biometrics_tracker.model.datapoints.Person

Return type

collections.namedtuple(‘person_data_t’, [‘id’, ‘name’, ‘dob’, ‘age’])

tests.model.datapoints_fixtures.person_data_fix()

Wraps person_data. This function is annotated as a pytest.fixture

Returns

a named tuple containing the properties needed to create a biometrics_tracker.model.datapoints.Person

Return type

collections.namedtuple(‘person_data_t’, [‘id’, ‘name’, ‘dob’, ‘age’])

tests.model.datapoints_fixtures.person_fix(person_data_fix) Person

A pytest.fixture wrapper for person()

Parameters

person_data_fix – a pytest.fixture providing the data to create a biometrics_tracker.model.datapoints.Person instance

Returns

a Person instance created from randomized data

Return type

biometrics_tracker.model.datapoints.Person

tests.model.datapoints_fixtures.pulse_data()

Uses the make_metric function to assemble a list data for the biometrics_tracker.model.datapoints.Pulse class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.pulse_data_fix()

A pytest.fixture wrapper for pulse_data()

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.pulse_dp_data_fix() list[collections.namedtuple]

Uses the make_datapoint function to assemble a list data for the biometrics_tracker.model.datapoints.PulseDP class

Returns

list[collections.namedtuple]

tests.model.datapoints_fixtures.schedule_data()

Creates a list of named tuples containing the data necessary to create a set of ScheduleEntry instances

Returns

a list of named tuples containing the data necessary to create a set of ScheduleEntry instances

Return type

list[collections.namedtuple(‘schedule_data_t’, [‘person_id’, ‘seq_nbr’, ‘frequency’, ‘dp_type’, ‘weekdays’, ‘days_of_month’, ‘interval’, ‘when_time’, ‘starts_on’, ‘ends_on’, ‘suspended’, ‘last_triggered’])]

tests.model.datapoints_fixtures.schedule_fix()

A pytest.fixture that uses tracking_config_data to create a list of Schedule instances

Returns

a list of ScheduleEntry instances

Return type

list[biometrics_tracker.model.datapoints.ScheduleEntry]

tests.model.datapoints_fixtures.tracking_config_data()

Creates a list of named tuples containing the data necessary to create a set of TrackingConfig instances

Returns

a list of named tuples containing the data necessary to create a set of TrackingConfig instances

Return type

list[collections.namedtuple(‘tracking_config_data_t’, [‘dp_type’, ‘default_uom’, ‘tracked’])]

tests.model.datapoints_fixtures.tracking_config_fix()

A pytest.fixture that uses tracking_config_data to create a list of TrackingConfig instances

Returns

a list of TrackingConfig instances

Return type

list[biometrics_tracker.model.datapoints.TrackingConfig]