From b2bf4224e8fa2b6cb0d538edeb1b1d9f41eae313 Mon Sep 17 00:00:00 2001 From: davidmunoznovoa Date: Fri, 2 Aug 2024 10:52:38 +0200 Subject: [PATCH 1/2] Update end date for CUPSDAT and CUPS45 --- mesures/cupsdat.py | 2 +- mesures/dates/date.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mesures/cupsdat.py b/mesures/cupsdat.py index abd11b7..217c93b 100644 --- a/mesures/cupsdat.py +++ b/mesures/cupsdat.py @@ -66,7 +66,7 @@ def reader(self, file_path): ) df['fecha_hora_final_vigencia'] = df.apply( - lambda row: REE_END_DATE_HOUR + lambda row: CUPSDAT_CPUS45_REE_END_DATE_HOUR if row['fecha_hora_final_vigencia'] == '' else datetime.strptime(row['fecha_hora_final_vigencia'], '%Y-%m-%d %H').strftime(DATE_MASK), axis=1) diff --git a/mesures/dates/date.py b/mesures/dates/date.py index 716c34f..a1e90ed 100644 --- a/mesures/dates/date.py +++ b/mesures/dates/date.py @@ -7,3 +7,6 @@ REE_END_DATE = '30000101' REE_END_DATE_HOUR = '3000/01/01 01' SIMPLE_DATE_MASK = '%Y%m%d' + +# Since v41 of SIMEL specifications +CUPSDAT_CPUS45_REE_END_DATE_HOUR = '3000/01/01 00' \ No newline at end of file From 679fb121d1d11d9ee79de63d63b825f58c8f57c5 Mon Sep 17 00:00:00 2001 From: davidmunoznovoa Date: Fri, 2 Aug 2024 11:00:29 +0200 Subject: [PATCH 2/2] Addapt tests to new behaviour --- spec/generation_files_spec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/generation_files_spec.py b/spec/generation_files_spec.py index c843873..02994c2 100644 --- a/spec/generation_files_spec.py +++ b/spec/generation_files_spec.py @@ -1291,7 +1291,7 @@ def get_sample_reobjecil_data(): expected = 'ES0291000000004444QR1F;CUPS de Demo 01;X0004444;4444;5555;2;' \ 'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/01 01;2022/10/17 00;17005;S;27\n' \ 'ES0291000000005555QR1F;CUPS de Demo 02;X0005555;4444;5555;2;' \ - 'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/17 01;3000/01/01 01;17005;S;27\n' + 'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/17 01;3000/01/01 00;17005;S;27\n' assert f.file[f.columns].to_csv(sep=';', header=None, index=False) == expected with description('A CUPS45'): @@ -1312,7 +1312,7 @@ def get_sample_reobjecil_data(): f = CUPS45(data) res = f.writer() expected = 'ES0291000000004444QR1F;4444;5555;5;E0;2T;E3;GI;4;4;5;0;0;0;S;2022/10/01 01;2022/10/17 00;0968;17005\n' \ - 'ES0291000000005555QR1F;4444;5555;5;E0;2T;E3;GI;4;4;4;0;0;0;S;2022/10/17 01;3000/01/01 01;0968;17005\n' + 'ES0291000000005555QR1F;4444;5555;5;E0;2T;E3;GI;4;4;4;0;0;0;S;2022/10/17 01;3000/01/01 00;0968;17005\n' assert f.file[f.columns].to_csv(sep=';', header=None, index=False) == expected with description('A MCIL345'):