Skip to content

Commit

Permalink
Merge pull request #110 from sbmlteam/sk-fix-errors
Browse files Browse the repository at this point in the history
Sk fix errors
  • Loading branch information
skeating committed Nov 9, 2023
2 parents 73aaec9 + e34820f commit 662bdfb
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -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 }}
Expand Down
3 changes: 2 additions & 1 deletion deviser/code_files/ValidationFiles.py
Expand Up @@ -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
Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
10 changes: 5 additions & 5 deletions deviser/pytest_files/test_cpp/test-extension/FooSBMLErrorTable.h
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -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"
}
},

Expand All @@ -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"
}
},

Expand All @@ -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"
}
},

Expand Down
Expand Up @@ -665,4 +665,6 @@ ExtraLong_isValidString(const char* code)



LIBSBML_CPP_NAMESPACE_END
LIBSBML_CPP_NAMESPACE_END


Expand Up @@ -746,4 +746,6 @@ LIBSBML_CPP_NAMESPACE_END



#endif /* !TestcaseExtension_H__ */
#endif /* !TestcaseExtension_H__ */


2 changes: 2 additions & 0 deletions deviser/pytest_files/test_examples/test_examples.py
Expand Up @@ -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'),
Expand Down
3 changes: 2 additions & 1 deletion deviser/util/global_variables.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deviser/validation/ValidationRulesForClass.py
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions deviser/validation/ValidationRulesGeneral.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion deviser/validation/ValidationXMLFiles.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 662bdfb

Please sign in to comment.