def test_unknown_clause(self):
     with self.assertRaises(ValueError):
         is_triggered(
             trigger_clause=None,
             trigger_value=Decimal("10"),
             last_notification_rate=Decimal("90"),
             current_rate=Decimal("99"),
         )
    def test_more(self):
        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.more,
                trigger_value=Decimal("0"),
                last_notification_rate=Decimal("100"),
                current_rate=Decimal("100"),
            ))

        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.more,
                trigger_value=Decimal("0"),
                last_notification_rate=Decimal("100"),
                current_rate=Decimal("101"),
            ))

        self.assertFalse(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.more,
                trigger_value=Decimal("0"),
                last_notification_rate=Decimal("100"),
                current_rate=Decimal("99"),
            ))
    def test_percent(self):
        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("99"),
            ))

        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("100"),
            ))

        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("81"),
            ))

        self.assertTrue(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("80"),
            ))

        self.assertFalse(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("82"),
            ))

        self.assertFalse(
            is_triggered(
                trigger_clause=NotifyTriggerClauseEnum.percent,
                trigger_value=Decimal("10"),
                last_notification_rate=Decimal("90"),
                current_rate=Decimal("98"),
            ))