예제 #1
0
    def test_create(self, comparison, threshold, reference_sample_id):
        alerter = ReferenceAlerter(comparison(threshold), reference_sample_id)

        msg = _AlertService.AlertReference(
            threshold=threshold,
            reference_sample_id=reference_sample_id,
            operator=comparison._OPERATOR,
        )
        assert alerter._as_proto() == msg
예제 #2
0
    def test_from_proto(self, comparison, threshold, reference_sample_id):
        msg = _AlertService.AlertReference(
            threshold=threshold,
            reference_sample_id=reference_sample_id,
            operator=comparison._OPERATOR,
        )

        alerter = _Alerter._from_proto(msg)
        assert type(alerter) is ReferenceAlerter
        assert alerter._as_proto() == msg
예제 #3
0
 def _as_proto(self):
     return _AlertService.AlertReference(
         threshold=self._comparison.value,
         reference_sample_id=self._reference_sample_id,
         operator=self._comparison._operator_as_proto(),
     )