@@ -608,26 +608,33 @@ def test_non_derived_token_with_invalid_target_attribute_raises_error(self):
608608 raises (ValueError , pattern = "Invalid attribute name 'CUSTOM_INVALID_FIELD'" ),
609609 )
610610
611- def test_non_derived_token_with_valid_target_attribute_works (self ):
611+ @pytest .mark .parametrize (
612+ ("token" , "expected" ),
613+ [
614+ ("TARGET.COVID.LAST_SUCCESSFUL_DATE" , 20260128 ), # expect value which is an integer
615+ ("TARGET.COVID.SUCCESSFUL_PROCEDURE_COUNT" , "3" ), # expect value which is a string
616+ ],
617+ )
618+ def test_non_derived_token_with_valid_target_attribute_works (self , token , expected ):
612619 """Test that non-derived tokens with valid target attributes work correctly."""
613620 person = Person (
614621 [
615- {"ATTRIBUTE_TYPE" : "COVID" , "LAST_SUCCESSFUL_DATE" : "20260128" },
622+ {"ATTRIBUTE_TYPE" : "COVID" , "LAST_SUCCESSFUL_DATE" : "20260128" , "SUCCESSFUL_PROCEDURE_COUNT" : "3" },
616623 ]
617624 )
618625
619626 condition = Condition (
620627 condition_name = ConditionName ("Test" ),
621628 status = Status .actionable ,
622- status_text = StatusText ("Last date : [[TARGET.COVID.LAST_SUCCESSFUL_DATE ]]" ),
629+ status_text = StatusText (f"test token : [[{ token } ]]" ),
623630 cohort_results = [],
624631 suitability_rules = [],
625632 actions = [],
626633 )
627634
628635 result = TokenProcessor .find_and_replace_tokens (person , condition )
629636
630- assert_that (result .status_text , is_ (equal_to ("Last date: 20260128 " )))
637+ assert_that (result .status_text , is_ (equal_to (f"test token: { expected } " )))
631638
632639 def test_person_level_attribute_with_add_days_without_explicit_source (self ):
633640 """Test that ADD_DAYS works on PERSON-level attributes without explicit source."""
0 commit comments