uranusjr commented on a change in pull request #21264:
URL: https://github.com/apache/airflow/pull/21264#discussion_r798520060



##########
File path: tests/utils/test_weight_rule.py
##########
@@ -18,12 +18,18 @@
 
 import unittest
 
+import pytest
+
 from airflow.utils.weight_rule import WeightRule
 
 
 class TestWeightRule(unittest.TestCase):
     def test_valid_weight_rules(self):
-        assert WeightRule.is_valid(WeightRule.DOWNSTREAM)
-        assert WeightRule.is_valid(WeightRule.UPSTREAM)
-        assert WeightRule.is_valid(WeightRule.ABSOLUTE)
-        assert len(WeightRule.all_weight_rules()) == 3
+        weight_rules = WeightRule.__members__.values()
+        for wr in weight_rules:
+            assert isinstance(wr, str)
+            assert WeightRule.is_valid(wr)
+        assert len(WeightRule.all_weight_rules()) == len(weight_rules)
+
+        with pytest.raises(ValueError):
+            WeightRule("NOT_EXIST_WEIGHT_RULE")

Review comment:
       Same here, the original test is better.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to