Skip to content

Commit

Permalink
Add docstring field to ImmutableMeasurement.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595470004
  • Loading branch information
OpenHTF Owners authored and copybara-github committed Jan 3, 2024
1 parent 7573009 commit 0d0316b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions openhtf/core/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,10 @@ def __getitem__(self, name: Text) -> Any:
# Return the MeasuredValue's value, MeasuredValue will raise if not set.
return m.measured_value.value

@property
def measurements(self) -> Dict[Text, Measurement]:
return self._measurements


# Work around for attrs bug in 20.1.0; after the next release, this can be
# removed and `Collection._custom_setattr` can be renamed to `__setattr__`.
Expand Down
5 changes: 4 additions & 1 deletion openhtf/core/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ImmutableMeasurement(object):
units = attr.ib(type=Optional[units.UnitDescriptor])
dimensions = attr.ib(type=Optional[List[measurements.Dimension]])
outcome = attr.ib(type=Optional[measurements.Outcome])
docstring = attr.ib(type=Optional[Text], default=None)

@classmethod
def from_measurement(
Expand All @@ -124,7 +125,9 @@ def from_measurement(
value=value,
units=measurement.units,
dimensions=measurement.dimensions,
outcome=measurement.outcome)
outcome=measurement.outcome,
docstring=measurement.docstring,
)


class TestState(util.SubscribableStateMixin):
Expand Down

0 comments on commit 0d0316b

Please sign in to comment.