diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 666c24cc..86fb5872 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [2.7, 3.7, 3.8, 3.9, '3.10', 3.11] + python-version: [3.7, 3.8, 3.9, '3.10', 3.11] platform: [windows-latest, ubuntu-latest, macos-latest] runs-on: ${{ matrix.platform }} diff --git a/deviser/code_files/ValidationFiles.py b/deviser/code_files/ValidationFiles.py index 60b63859..7e8934fd 100644 --- a/deviser/code_files/ValidationFiles.py +++ b/deviser/code_files/ValidationFiles.py @@ -103,11 +103,12 @@ def create_rule_structure(self): number = self.offset else: number = 0 + full_package = f'{global_variables.package_full_name} Package' if global_variables.is_sbml else global_variables.language rules = ValidationRulesGeneral\ .ValidationRulesGeneral(self.fullname, number, self.package, self.pkg_ref, self.level, self.version, self.pkg_version, self.reqd_status, - global_variables.language) + full_package) rules.determine_rules() self.class_rules += rules.rules number = self.offset + 20200 if global_variables.is_sbml else 20100 diff --git a/deviser/pytest_files/test_cpp/test-extension/DistribSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/DistribSBMLErrorTable.h index 388337f9..5ed315b7 100644 --- a/deviser/pytest_files/test_cpp/test-extension/DistribSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/DistribSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry distribErrorTable[] = { // 1510100 { DistribUnknown, - "Unknown error from Distrib", + "Unknown error from DISTRIB", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Distrib", - { "" + "Unknown error from DISTRIB", + { "L3V1 Distrib V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry distribErrorTable[] = "Version 2, an SBML document must declare " "'http://www.sbml.org/sbml/level3/version2/distrib/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Distrib V1 Section 3.1" + { "L3V1 Distrib V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry distribErrorTable[] = "Distributions Package must use the " "'http://www.sbml.org/sbml/level3/version2/distrib/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Distrib V1 Section 3.1" + { "L3V1 Distrib V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/FooSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/FooSBMLErrorTable.h index 7e292e74..413adeee 100644 --- a/deviser/pytest_files/test_cpp/test-extension/FooSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/FooSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry fooErrorTable[] = { // 110100 { FooUnknown, - "Unknown error from Foo", + "Unknown error from FOO", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Foo", - { "" + "Unknown error from FOO", + { "L3V1 Foo V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry fooErrorTable[] = "SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/foo/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Foo V1 Section 3.1" + { "L3V1 Foo V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry fooErrorTable[] = "Foo Package must use the " "'http://www.sbml.org/sbml/level3/version1/foo/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Foo V1 Section 3.1" + { "L3V1 Foo V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/GroupsSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/GroupsSBMLErrorTable.h index d4c216e9..65ca3d8d 100644 --- a/deviser/pytest_files/test_cpp/test-extension/GroupsSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/GroupsSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry groupsErrorTable[] = { // 4010100 { GroupsUnknown, - "Unknown error from Groups", + "Unknown error from GROUPS", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Groups", - { "" + "Unknown error from GROUPS", + { "L3V1 Groups V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry groupsErrorTable[] = "an SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/groups/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Groups V1 Section 3.1" + { "L3V1 Groups V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry groupsErrorTable[] = "Groups Package must use the " "'http://www.sbml.org/sbml/level3/version1/groups/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Groups V1 Section 3.1" + { "L3V1 Groups V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/QualSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/QualSBMLErrorTable.h index 09bc8765..51a79b8f 100644 --- a/deviser/pytest_files/test_cpp/test-extension/QualSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/QualSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry qualErrorTable[] = { // 3010100 { QualUnknown, - "Unknown error from Qual", + "Unknown error from QUAL", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Qual", - { "" + "Unknown error from QUAL", + { "L3V1 Qual V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry qualErrorTable[] = "3 Version 1, an SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/qual/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Qual V1 Section 3.1" + { "L3V1 Qual V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry qualErrorTable[] = "Qualitative Models Package must use the " "'http://www.sbml.org/sbml/level3/version1/qual/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Qual V1 Section 3.1" + { "L3V1 Qual V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/RefsSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/RefsSBMLErrorTable.h index d529975c..1de899f9 100644 --- a/deviser/pytest_files/test_cpp/test-extension/RefsSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/RefsSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry refsErrorTable[] = { // 110100 { RefsUnknown, - "Unknown error from Refs", + "Unknown error from REFS", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Refs", - { "" + "Unknown error from REFS", + { "L3V1 Refs V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry refsErrorTable[] = "Version 1, an SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/refs/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Refs V1 Section 3.1" + { "L3V1 Refs V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry refsErrorTable[] = "SID References Package must use the " "'http://www.sbml.org/sbml/level3/version1/refs/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Refs V1 Section 3.1" + { "L3V1 Refs V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/RenderSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/RenderSBMLErrorTable.h index dab45c42..1bcbd1a8 100644 --- a/deviser/pytest_files/test_cpp/test-extension/RenderSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/RenderSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry renderErrorTable[] = { // 1310100 { RenderUnknown, - "Unknown error from Render", + "Unknown error from RENDER", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Render", - { "" + "Unknown error from RENDER", + { "L3V1 Render V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry renderErrorTable[] = "an SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/render/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Render V1 Section 3.1" + { "L3V1 Render V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry renderErrorTable[] = "Render Package must use the " "'http://www.sbml.org/sbml/level3/version1/render/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Render V1 Section 3.1" + { "L3V1 Render V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/TestSBMLErrorTable.h b/deviser/pytest_files/test_cpp/test-extension/TestSBMLErrorTable.h index 58ae441a..ab33c903 100644 --- a/deviser/pytest_files/test_cpp/test-extension/TestSBMLErrorTable.h +++ b/deviser/pytest_files/test_cpp/test-extension/TestSBMLErrorTable.h @@ -53,11 +53,11 @@ static const packageErrorTableEntry testErrorTable[] = { // 10010100 { TestUnknown, - "Unknown error from Test", + "Unknown error from TEST", LIBSBML_CAT_GENERAL_CONSISTENCY, LIBSBML_SEV_ERROR, - "Unknown error from Test", - { "" + "Unknown error from TEST", + { "L3V1 Test V1 Section" } }, @@ -70,7 +70,7 @@ static const packageErrorTableEntry testErrorTable[] = "Version 1, an SBML document must declare " "'http://www.sbml.org/sbml/level3/version1/test/version1' as the " "XMLNamespace to use for elements of this package.", - { "L3V1 Test V1 Section 3.1" + { "L3V1 Test V1 Section" } }, @@ -83,7 +83,7 @@ static const packageErrorTableEntry testErrorTable[] = "testAttributes Package must use the " "'http://www.sbml.org/sbml/level3/version1/test/version1' namespace, " "declaring so either explicitly or implicitly.", - { "L3V1 Test V1 Section 3.1" + { "L3V1 Test V1 Section" } }, diff --git a/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.cpp b/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.cpp index 7e347674..a8f99622 100644 --- a/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.cpp +++ b/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.cpp @@ -665,4 +665,6 @@ ExtraLong_isValidString(const char* code) -LIBSBML_CPP_NAMESPACE_END \ No newline at end of file +LIBSBML_CPP_NAMESPACE_END + + diff --git a/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.h b/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.h index b558a43d..0876add5 100644 --- a/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.h +++ b/deviser/pytest_files/test_cpp/test-extension/TestcaseExtension.h @@ -746,4 +746,6 @@ LIBSBML_CPP_NAMESPACE_END -#endif /* !TestcaseExtension_H__ */ \ No newline at end of file +#endif /* !TestcaseExtension_H__ */ + + diff --git a/deviser/pytest_files/test_examples/test_examples.py b/deviser/pytest_files/test_examples/test_examples.py index 41b83c0a..32750af9 100644 --- a/deviser/pytest_files/test_examples/test_examples.py +++ b/deviser/pytest_files/test_examples/test_examples.py @@ -54,6 +54,8 @@ def test_specific_xml_fail(name, start, stop, number): """ assert 0 == ret.run_specific_xml_fail_tests(name, start, stop, number) + +######################################################################################################### # fails # @pytest.mark.parametrize('name', [ # ('base_class'), diff --git a/deviser/util/global_variables.py b/deviser/util/global_variables.py index a952fd55..4a843956 100644 --- a/deviser/util/global_variables.py +++ b/deviser/util/global_variables.py @@ -192,10 +192,11 @@ def set_globals(lang, base, doc, prfix, lib, is_pack, pkg_prefix, specifications=[], depend=[], library_vers=[], my_copyright='', annot_elem='', notes_elem='', use_id_1=True, use_name_1=True, ast=False, xml=False, top_name=''): + global is_sbml + is_sbml = True global language language = lang if language != 'sbml': - global is_sbml is_sbml = False global namespaces diff --git a/deviser/validation/ValidationRulesForClass.py b/deviser/validation/ValidationRulesForClass.py index 4acb29ed..824e04f8 100644 --- a/deviser/validation/ValidationRulesForClass.py +++ b/deviser/validation/ValidationRulesForClass.py @@ -86,7 +86,7 @@ def __init__(self, object_desc, spec_name, number, package, pkg_ref): # constants for rules if global_variables.is_sbml: self.up_package = strFunctions.upper_first(self.package) - self.lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) + self.lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) else: self.up_package = self.package.upper() self.lib_ref = '{0} L{1}V{2} Section '.format(self.up_package, self.level, self.version) diff --git a/deviser/validation/ValidationRulesGeneral.py b/deviser/validation/ValidationRulesGeneral.py index 51904668..26789da9 100644 --- a/deviser/validation/ValidationRulesGeneral.py +++ b/deviser/validation/ValidationRulesGeneral.py @@ -71,7 +71,7 @@ def __init__(self, spec_name, number, package, pkg_ref, level, version, self.tc = 'TBC' # constants for rules if global_variables.is_sbml: - self.lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) + self.lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) self.up_package = strFunctions.upper_first(self.package) else: self.lib_ref = '{0} L{1}V{2} Section '.format(self.up_package.upper(), self.level, self.version) @@ -195,7 +195,7 @@ def write_unknown_rule(self): ref = '' sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) - short = 'Unknown error from {0}'.format(self.up_package.upper())*10 + short = 'Unknown error from {0}'.format(self.up_package.upper()) tc = global_variables.unknown_error return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, diff --git a/deviser/validation/ValidationXMLFiles.py b/deviser/validation/ValidationXMLFiles.py index fc4b4fc1..4cff41f7 100644 --- a/deviser/validation/ValidationXMLFiles.py +++ b/deviser/validation/ValidationXMLFiles.py @@ -67,6 +67,7 @@ def __init__(self, lib_object, verbose=False): self.pkg_version = lib_object['pkg_version'] self.pkg_ref = 'NA' self.reqd_status = lib_object['required'] + self.full_package_command = lib_object['name'] + ' Package' self.tree = query.create_object_tree(lib_object, False) @@ -127,7 +128,7 @@ def determine_rules(self): rules = ValidationRulesGeneral\ .ValidationRulesGeneral(self.fullname, number, self.package, self.pkg_ref, self.level, self.version, - self.pkg_version, self.reqd_status) + self.pkg_version, self.reqd_status, self.full_package_command) rules.determine_rules() self.class_rules += rules.rules number = self.offset + 20200