From 98d16cfdd0b7a551396906908ad5054e6d47cef0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 30 Mar 2026 07:28:21 -0700 Subject: [PATCH 1/6] Bug fix in schema/suite_v2_0.xsd: use fortran_id_type_unique and fortran_id_type for scheme, group, and suite names --- schema/suite_v2_0.xsd | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/schema/suite_v2_0.xsd b/schema/suite_v2_0.xsd index 51afeece..7355b10c 100644 --- a/schema/suite_v2_0.xsd +++ b/schema/suite_v2_0.xsd @@ -17,6 +17,12 @@ + + + + + + @@ -32,8 +38,8 @@ - - + + @@ -41,8 +47,8 @@ - - + + @@ -51,8 +57,8 @@ - - + + @@ -94,7 +100,7 @@ - + @@ -122,7 +128,7 @@ - + @@ -142,8 +148,8 @@ - - + + From 9b7dbff8a08f09ef4d5e3e668df7fab069ac6d0a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 30 Mar 2026 07:29:23 -0700 Subject: [PATCH 2/6] Add unit tests for valid Fortran IDs for schemes, groups, suites --- .../suite_bad_invalid_fortran_id_01.xml | 8 ++++++ .../suite_bad_invalid_fortran_id_02.xml | 8 ++++++ .../suite_bad_invalid_fortran_id_03.xml | 8 ++++++ test/unit_tests/test_sdf.py | 28 ++++++++++++++++++- 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml create mode 100644 test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml create mode 100644 test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml new file mode 100644 index 00000000..e236cbd0 --- /dev/null +++ b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml @@ -0,0 +1,8 @@ + + + + + scheme-1 + scheme2 + + diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml new file mode 100644 index 00000000..0fbb40dc --- /dev/null +++ b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml @@ -0,0 +1,8 @@ + + + + + scheme1 + scheme2 + + diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml new file mode 100644 index 00000000..ae8a28a4 --- /dev/null +++ b/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml @@ -0,0 +1,8 @@ + + + + + scheme1 + scheme2 + + diff --git a/test/unit_tests/test_sdf.py b/test/unit_tests/test_sdf.py index 5dd73d95..46efa8b6 100644 --- a/test/unit_tests/test_sdf.py +++ b/test/unit_tests/test_sdf.py @@ -371,7 +371,7 @@ def test_bad_v2_suite_duplicate_group1(self): _ = validate_xml_file(compare, 'suite', schema_version, logger) # end with emsg = "Schemas validity error : Element 'group', attribute 'name': " + \ - "'group1' is not a valid value of the atomic type 'xs:ID'" + "'group1' is not a valid value of the atomic type 'fortran_id_type_unique'" fmsg = str(context.exception) self.assertTrue(emsg in fmsg, msg=fmsg) if not emsg in fmsg: @@ -534,3 +534,29 @@ def test_missing_schema_version(self): # Check exception for expected error messages self.assertTrue("version attribute required" in str(context.exception), msg=f"Bad exception for missing suite version") + + def test_bad_fortran_id(self): + """Test that verification system recognizes a bad Fortran ID entry""" + num_tests = 3 + header = "Test trapping of invalid Fortran ID" + exc_strings = ["The value 'scheme-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + "The value 'group-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + "he value 'ver-test-suite' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}"] + for test_num in range(num_tests): + # Setup + testname = f"suite_bad_invalid_fortran_id_{test_num+1:{0}{2}}" + source = os.path.join(_SAMPLE_FILES_DIR, f"{testname}.xml") + logger = self.get_logger() + _, xml_root = read_xml_file(source, logger) + schema_version = find_schema_version(xml_root) + self.assertEqual(schema_version[0], 2) + self.assertEqual(schema_version[1], 0) + # Exercise + with self.assertRaises(Exception) as context: + res = validate_xml_file(source, 'suite', schema_version, logger) + # end with + # Check exception for expected error messages + exp_str = str(context.exception) + self.assertTrue(exc_strings[test_num] in exp_str, + msg=f"Bad exception in test {test_num + 1}, '{exp_str}'") + # end for From 224537c56e36bdf904f16329ac6e9c1fd66e4f45 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 2 Apr 2026 11:01:56 -0600 Subject: [PATCH 3/6] Update schema/suite_v2_0.xsd --- schema/suite_v2_0.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/suite_v2_0.xsd b/schema/suite_v2_0.xsd index 7355b10c..ec4dda5b 100644 --- a/schema/suite_v2_0.xsd +++ b/schema/suite_v2_0.xsd @@ -38,7 +38,7 @@ - + From 0045b7fd5c7c500a17afdd9fc4088deed345ffd1 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 13 Apr 2026 17:14:40 -0600 Subject: [PATCH 4/6] Remove name attribute from subcycle element in schema/suite_v2_0.xsd --- schema/suite_v2_0.xsd | 1 - 1 file changed, 1 deletion(-) diff --git a/schema/suite_v2_0.xsd b/schema/suite_v2_0.xsd index ec4dda5b..0753ee97 100644 --- a/schema/suite_v2_0.xsd +++ b/schema/suite_v2_0.xsd @@ -100,7 +100,6 @@ - From bcc32dca2e22a8d81b405122b87545d6f7e1998b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 13 Apr 2026 17:23:37 -0600 Subject: [PATCH 5/6] Rename suite definition files for unit tests that test catching invalid Fortran IDs --- ...2.xml => suite_invalid_group_fortran_id.xml} | 0 ....xml => suite_invalid_scheme_fortran_id.xml} | 0 ...3.xml => suite_invalid_suite_fortran_id.xml} | 0 test/unit_tests/test_sdf.py | 17 ++++++++++++----- 4 files changed, 12 insertions(+), 5 deletions(-) rename test/unit_tests/sample_suite_files/{suite_bad_invalid_fortran_id_02.xml => suite_invalid_group_fortran_id.xml} (100%) rename test/unit_tests/sample_suite_files/{suite_bad_invalid_fortran_id_01.xml => suite_invalid_scheme_fortran_id.xml} (100%) rename test/unit_tests/sample_suite_files/{suite_bad_invalid_fortran_id_03.xml => suite_invalid_suite_fortran_id.xml} (100%) diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml b/test/unit_tests/sample_suite_files/suite_invalid_group_fortran_id.xml similarity index 100% rename from test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_02.xml rename to test/unit_tests/sample_suite_files/suite_invalid_group_fortran_id.xml diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml b/test/unit_tests/sample_suite_files/suite_invalid_scheme_fortran_id.xml similarity index 100% rename from test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_01.xml rename to test/unit_tests/sample_suite_files/suite_invalid_scheme_fortran_id.xml diff --git a/test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml b/test/unit_tests/sample_suite_files/suite_invalid_suite_fortran_id.xml similarity index 100% rename from test/unit_tests/sample_suite_files/suite_bad_invalid_fortran_id_03.xml rename to test/unit_tests/sample_suite_files/suite_invalid_suite_fortran_id.xml diff --git a/test/unit_tests/test_sdf.py b/test/unit_tests/test_sdf.py index 46efa8b6..ee865753 100644 --- a/test/unit_tests/test_sdf.py +++ b/test/unit_tests/test_sdf.py @@ -535,16 +535,23 @@ def test_missing_schema_version(self): self.assertTrue("version attribute required" in str(context.exception), msg=f"Bad exception for missing suite version") - def test_bad_fortran_id(self): + def test_invalid_fortran_id(self): """Test that verification system recognizes a bad Fortran ID entry""" num_tests = 3 header = "Test trapping of invalid Fortran ID" - exc_strings = ["The value 'scheme-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", - "The value 'group-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", - "he value 'ver-test-suite' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}"] + tests = [ + "suite_invalid_scheme_fortran_id", + "suite_invalid_group_fortran_id", + "suite_invalid_suite_fortran_id", + ] + exc_strings = [ + "The value 'scheme-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + "The value 'group-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + "he value 'ver-test-suite' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + ] for test_num in range(num_tests): # Setup - testname = f"suite_bad_invalid_fortran_id_{test_num+1:{0}{2}}" + testname = tests[test_num] source = os.path.join(_SAMPLE_FILES_DIR, f"{testname}.xml") logger = self.get_logger() _, xml_root = read_xml_file(source, logger) From 1d7ee9c59f685c9b64e12fd9e96440ed0ca0a2a2 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 14 Apr 2026 11:36:39 -0600 Subject: [PATCH 6/6] Apply suggestion from @climbfuji --- test/unit_tests/test_sdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit_tests/test_sdf.py b/test/unit_tests/test_sdf.py index ee865753..fbb2c1db 100644 --- a/test/unit_tests/test_sdf.py +++ b/test/unit_tests/test_sdf.py @@ -547,7 +547,7 @@ def test_invalid_fortran_id(self): exc_strings = [ "The value 'scheme-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", "The value 'group-1' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", - "he value 'ver-test-suite' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", + "The value 'ver-test-suite' is not accepted by the pattern '[A-Za-z][A-Za-z0-9_]{0,63}", ] for test_num in range(num_tests): # Setup