Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
echeng06 committed Nov 21, 2024
1 parent 1452cfd commit 16f8283
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nacc_form_validator/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __set_custom_error_codes(self):
0x1009:
"{1} for if {2} else {3} - compatibility rule no: {0}",
0x2000:
"{1} in current visit for if {2} in previous visit then {3} " +
"{1} for if {2} in previous visit then {3} " +
"in current visit - temporal rule no: {0}",
0x2001:
"primary key variable {0} not set in current visit data",
Expand Down Expand Up @@ -122,7 +122,7 @@ def __set_custom_error_codes(self):
0x3003:
"Error in comparing {0} to age at {1} ({2}): {3}",
0x3004:
"{1} in previous visit for if {3} in current visit then {2} " +
"{1} for if {3} in current visit then {2} " +
"in previous visit - temporal rule no: {0}",
}

Expand Down
6 changes: 3 additions & 3 deletions tests/test_nacc_validator_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_temporal_check(schema):

assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 4, 'taxes': 8})
assert nv.errors == {'taxes': [
"('taxes', ['unallowed value 8']) in current visit for if {'taxes': {'allowed': [0]}} in previous visit then {'taxes': {'forbidden': [8]}} in current visit - temporal rule no: 0"]}
"('taxes', ['unallowed value 8']) for if {'taxes': {'allowed': [0]}} in previous visit then {'taxes': {'forbidden': [8]}} in current visit - temporal rule no: 0"]}

def test_temporal_check_swap_order(schema):
""" Test temporal check when the order of evaluation is swapped """
Expand All @@ -139,7 +139,7 @@ def test_temporal_check_swap_order(schema):
nv.reset_record_cache()
assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 2, 'taxes': 1})
assert nv.errors == {'taxes': [
"('taxes', ['unallowed value 8']) in previous visit for if {'taxes': {'forbidden': [8]}} in current visit then {'taxes': {'allowed': [0]}} in previous visit - temporal rule no: 0"]}
"('taxes', ['unallowed value 8']) for if {'taxes': {'forbidden': [8]}} in current visit then {'taxes': {'allowed': [0]}} in previous visit - temporal rule no: 0"]}

def test_temporal_check_no_prev_visit(schema):
""" Temporal test check when there are no previous visits (e.g. before visit 0) """
Expand Down Expand Up @@ -305,7 +305,7 @@ def test_temporal_check_with_nested_compare_with_previous_record():

assert not nv.validate({'patient_id': 'PatientID1', 'visit_num': 4, 'birthyr': 1951})
assert nv.errors == {'birthyr': [
'(\'birthyr\', ["input value doesn\'t satisfy the condition birthyr == birthyr (previous record)"]) in current visit for ' +
'(\'birthyr\', ["input value doesn\'t satisfy the condition birthyr == birthyr (previous record)"]) for ' +
'if {\'birthyr\': {\'forbidden\': [-1]}} in previous visit ' +
'then {\'birthyr\': {\'compare_with\': {\'comparator\': \'==\', \'base\': \'birthyr\', \'previous_record\': True}}} in current visit ' +
'- temporal rule no: 0']}
Expand Down

0 comments on commit 16f8283

Please sign in to comment.