From a3a6919bcc07f7224fe17417d556c711c8956c60 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Wed, 20 Nov 2024 10:27:01 -0500 Subject: [PATCH 1/3] - Updated validators based on new coding instructions - Updated test --- tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py | 2 +- tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py | 6 +++--- tdrs-backend/tdpservice/parsers/test/test_parse.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py index 82d5c2c46..20edf6fdb 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/ssp/m2.py @@ -317,7 +317,7 @@ startIndex=48, endIndex=49, required=False, - validators=[category2.isGreaterThan(0)] + validators=[category2.isGreaterThan(0, inclusive=True)] ), Field( item="32E", diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py index 8f9aba575..3bd642c03 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py @@ -68,7 +68,7 @@ ), category3.ifThenAlso( condition_field_name="SANC_REDUCTION_AMT", - condition_function=category3.isGreaterThan(0), + condition_function=category3.isGreaterThan(0, inclusive=True), result_field_name="FAMILY_SANC_ADULT", result_function=category3.isOneOf((1, 2)), ), @@ -635,7 +635,7 @@ endIndex=114, required=False, validators=[ - category2.isOneOf(["9", " "]), + category2.isOneOf(["9", "0", " "]), category2.isAlphaNumeric(), ], ), @@ -658,7 +658,7 @@ endIndex=117, required=False, validators=[ - category2.isOneOf([1, 2]), + category2.isOneOf([0, 1, 2]), ], ), Field( diff --git a/tdrs-backend/tdpservice/parsers/test/test_parse.py b/tdrs-backend/tdpservice/parsers/test/test_parse.py index d01a44030..cc4f758a8 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_parse.py +++ b/tdrs-backend/tdpservice/parsers/test/test_parse.py @@ -950,7 +950,7 @@ def test_parse_tanf_section1_blanks_file(tanf_section1_file_with_blanks, dfs): parser_errors = ParserError.objects.filter(file=tanf_section1_file_with_blanks) - assert parser_errors.count() == 22 + assert parser_errors.count() == 23 # Should only be cat3 validator errors for error in parser_errors: From cdaa7fcce1fc412ef5d56df87e1faae7556d4db4 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Fri, 6 Dec 2024 14:04:20 -0500 Subject: [PATCH 2/3] - remove validator --- tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py index 3bd642c03..9dc92acd1 100644 --- a/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py +++ b/tdrs-backend/tdpservice/parsers/schema_defs/tanf/t1.py @@ -66,12 +66,6 @@ result_field_name="WORK_REQ_SANCTION", result_function=category3.isOneOf((1, 2)), ), - category3.ifThenAlso( - condition_field_name="SANC_REDUCTION_AMT", - condition_function=category3.isGreaterThan(0, inclusive=True), - result_field_name="FAMILY_SANC_ADULT", - result_function=category3.isOneOf((1, 2)), - ), category3.ifThenAlso( condition_field_name="SANC_REDUCTION_AMT", condition_function=category3.isGreaterThan(0), From c7778e5d6c610686b11e88dd0861b0a0e371e092 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Fri, 6 Dec 2024 14:25:29 -0500 Subject: [PATCH 3/3] - Correct num errors --- tdrs-backend/tdpservice/parsers/test/test_parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdrs-backend/tdpservice/parsers/test/test_parse.py b/tdrs-backend/tdpservice/parsers/test/test_parse.py index cc4f758a8..d01a44030 100644 --- a/tdrs-backend/tdpservice/parsers/test/test_parse.py +++ b/tdrs-backend/tdpservice/parsers/test/test_parse.py @@ -950,7 +950,7 @@ def test_parse_tanf_section1_blanks_file(tanf_section1_file_with_blanks, dfs): parser_errors = ParserError.objects.filter(file=tanf_section1_file_with_blanks) - assert parser_errors.count() == 23 + assert parser_errors.count() == 22 # Should only be cat3 validator errors for error in parser_errors: