@@ -816,39 +816,30 @@ def test_status_if_iteration_rules_contains_cohort_label_field(
816816@pytest .mark .parametrize (
817817 ("rule_stop" , "expected_status" , "test_comment" ),
818818 [
819- ("Y" , Status .not_actionable , "Stops at the first rule" ),
820- ("N" , Status .not_eligible , "Both the rules are executed" ),
821- ("" , Status .not_eligible , "Both the rules are executed" ),
822- (None , Status .not_eligible , "Both the rules are executed" ),
819+ (True , Status .not_actionable , "Stops at the first rule" ),
820+ (False , Status .not_eligible , "Both the rules are executed" ),
823821 ],
824822)
825- def test_rules_stop_behavior (rule_stop : str | None , expected_status : Status , test_comment : str , faker : Faker ) -> None :
823+ def test_rules_stop_behavior (rule_stop : bool , expected_status : Status , test_comment : str , faker : Faker ) -> None : # noqa: FBT001
826824 # Given
827825 nhs_number = NHSNumber (faker .nhs_number ())
828826 date_of_birth = DateOfBirth (faker .date_of_birth (minimum_age = 18 , maximum_age = 74 ))
829827 person_rows = person_rows_builder (nhs_number , date_of_birth = date_of_birth , cohorts = ["cohort1" ])
830828
831- # Base rule template
832- # Not using model factory to create Iteration rules since it sets boolean values for "Y"/"N"
833- iteration_rules = [
834- rule_builder .PersonAgeSuppressionRuleFactory .build (
835- type = rules .RuleType .suppression , priority = 10 , rule_stop = rule_stop
836- ),
837- rule_builder .PersonAgeSuppressionRuleFactory .build (type = rules .RuleType .suppression , priority = 10 ),
838- rule_builder .PersonAgeSuppressionRuleFactory .build (type = rules .RuleType .filter , priority = 15 ),
839- ]
840-
841829 # Build campaign configuration
842830 campaign_config = rule_builder .CampaignConfigFactory .build (
843831 target = "RSV" ,
844832 iterations = [
845833 rule_builder .IterationFactory .build (
846- iteration_rules = [],
834+ iteration_rules = [
835+ rule_builder .PersonAgeSuppressionRuleFactory .build (priority = 10 , rule_stop = rule_stop ),
836+ rule_builder .PersonAgeSuppressionRuleFactory .build (priority = 10 ),
837+ rule_builder .PersonAgeSuppressionRuleFactory .build (type = rules .RuleType .filter , priority = 15 ),
838+ ],
847839 iteration_cohorts = [rule_builder .IterationCohortFactory .build (cohort_label = "cohort1" )],
848840 )
849841 ],
850842 )
851- campaign_config .iterations [0 ].iteration_rules .extend (iteration_rules )
852843
853844 calculator = EligibilityCalculator (person_rows , [campaign_config ])
854845
0 commit comments