def test_from_proto(self, lower_bound, upper_bound, alert_if_outside_range): msg = _AlertService.AlertRange( lower_bound=lower_bound, upper_bound=upper_bound, alert_if_outside_range=alert_if_outside_range, ) alerter = _Alerter._from_proto(msg) assert type(alerter) is RangeAlerter assert alerter._as_proto() == msg
def test_to_proto(self, lower_bound, upper_bound, alert_if_outside_range): alerter = RangeAlerter( lower_bound=lower_bound, upper_bound=upper_bound, alert_if_outside_range=alert_if_outside_range, ) msg = _AlertService.AlertRange( lower_bound=lower_bound, upper_bound=upper_bound, alert_if_outside_range=alert_if_outside_range, ) assert alerter._as_proto() == msg
def _as_proto(self): return _AlertService.AlertRange( lower_bound=self.lower_bound, upper_bound=self.upper_bound, alert_if_outside_range=self.alert_if_outside_range, )