def test_creation_and_hydration(self): rd1, metrics, params = self._create() self._check(rd1, metrics, params) as_dict = {"metrics": metrics, "params": params} self.assertEqual(dict(rd1), as_dict) proto = rd1.to_proto() rd2 = RunData.from_proto(proto) self._check(rd2, metrics, params) rd3 = RunData.from_dictionary(as_dict) self._check(rd3, metrics, params)
def from_proto(cls, proto): return cls(RunInfo.from_proto(proto.info), RunData.from_proto(proto.data))