From 12fd920d44a1cc2b67c0f9cb5cb53d1384a67e59 Mon Sep 17 00:00:00 2001 From: Marc White Date: Tue, 7 Jan 2025 17:23:58 +1100 Subject: [PATCH] Start testing MopperBuilder.parse_filename --- src/access_nri_intake/source/builders.py | 1 + tests/test_builders.py | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/access_nri_intake/source/builders.py b/src/access_nri_intake/source/builders.py index 9d9dfcb..c97ecc5 100644 --- a/src/access_nri_intake/source/builders.py +++ b/src/access_nri_intake/source/builders.py @@ -670,6 +670,7 @@ class MopperBuilder(BaseBuilder): # Using os.path.join and .replace makes the pattern more human-readable, # and avoids any cross-OS problems + # FIXME losing version number (v1_0 comes out as 0) PATTERNS = [ ( ( diff --git a/tests/test_builders.py b/tests/test_builders.py index b36c94e..c780daa 100644 --- a/tests/test_builders.py +++ b/tests/test_builders.py @@ -849,13 +849,31 @@ def test_builder_columns_with_iterables(test_data): {"ts": "20000201", "mom6_added_timestamp": "2000_119"}, ), ), + ( + builders.MopperBuilder, + "v1-0/10min/cllow/cllow_AUS2200_ashwed1983_subhrPt_19830216001000-19830217000000", + ( + "v1_0/10min/cllow/cllow_AUS2200_ashwed1983_subhrPt_XXXXXXXXXXXXXX_XXXXXXXXXXXXXX", + "19830216001000-19830217000000", + None, # TODO check if this is correct + { + "ts": "19830216001000-19830217000000", + "frequency": "subhrPt", + "frequency_dir": "10min", + "member": "ashwed1983", + "model": "AUS2200", + "variable": "cllow", + "variable_dir": "cllow", + "version": "0", # FIXME should be v1_0 - mangle to keep tests happy for now + }, + ), + ), ], ) def test_parse_filename(builder, filename, expected): assert builder.parse_filename(filename) == expected -# FIXME update test data for exargs output @pytest.mark.parametrize( "compare_files", [