@@ -749,7 +749,7 @@ def test_pre_validate_extension_snomed_code(self):
749749 """Test test_pre_validate_extension_url accepts valid values and rejects invalid values for extension[0].url"""
750750 # Test case: missing "extension"
751751 invalid_json_data = deepcopy (self .json_data )
752- test_values = ["12345abc" , "12345" , "1234567890123456789" , "12345671" , "1324681000000111" ]
752+ test_values = ["12345abc" , "12345" , "1234567890123456789" , "12345671" , "1324681000000111" , "0101291008" ]
753753 for values in test_values :
754754 invalid_json_data ["extension" ][0 ]["valueCodeableConcept" ]["coding" ][0 ]["code" ] = values
755755
@@ -1201,6 +1201,20 @@ def test_pre_validate_location_identifier_system(self):
12011201 valid_strings_to_test = ["https://fhir.hl7.org.uk/Id/140565" ],
12021202 )
12031203
1204+ def test_pre_validate_vaccine_code (self ):
1205+ """Test pre_validate_vaccine_code accepts valid values and rejects invalid values for vaccineCode.coding[0].code"""
1206+ invalid_json_data = deepcopy (self .json_data )
1207+ test_values = ["12345abc" , "12345" , "1234567890123456789" , "12345671" , "1324681000000111" , "0101291008" ]
1208+ for values in test_values :
1209+ invalid_json_data ["vaccineCode" ]["coding" ][0 ]["code" ] = values
1210+
1211+ with self .assertRaises (Exception ) as error :
1212+ self .validator .validate (invalid_json_data )
1213+
1214+ full_error_message = str (error .exception )
1215+ actual_error_messages = full_error_message .replace ("Validation errors: " , "" ).split ("; " )
1216+ self .assertIn ("vaccineCode.coding[?(@.system=='http://snomed.info/sct')].code is not a valid snomed code" , actual_error_messages )
1217+
12041218
12051219class TestImmunizationModelPreValidationRulesForReduceValidation (unittest .TestCase ):
12061220 """Test immunization pre validation rules on the FHIR model using the status="reduce validation" data"""
0 commit comments