Skip to content

Commit

Permalink
changes while i work on error files
Browse files Browse the repository at this point in the history
  • Loading branch information
skeating committed Jun 24, 2023
1 parent 23d3168 commit 99796d3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 59 deletions.
3 changes: 2 additions & 1 deletion deviser/code_files/ValidationFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def create_rule_structure(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,
global_variables.language)
rules.determine_rules()
self.class_rules += rules.rules
if global_variables.is_package:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ static const tsbErrorTableEntry tsbErrorTable[] =
"The Tsb namespace is not correctly declared.",
LIBTSB_CAT_GENERAL_CONSISTENCY,
LIBTSB_SEV_ERROR,
"To conform to the Package specification for SBML Level 0 Version 1, an "
"SBML document must declare "
"'http://www.sbml.org/sbml/level0/version1/tsb/version0' as the "
"XMLNamespace to use for elements of this package.",
"To conform to the tsb specification for TSB Level 1 Version 1, an TSB "
"document must declare 'http://testsbxml.org/l1v1' as the XMLNamespace to "
"use for elements of this package.",
{ "L3V1 Tsb V1 Section 3.1"
}
},
Expand Down Expand Up @@ -446,20 +445,20 @@ static const tsbErrorTableEntry tsbErrorTable[] =
}
},

// 20303
// 20301
{ TsbCommentAllowedAttributes,
"Attributes allowed on <comment>.",
LIBTSB_CAT_GENERAL_CONSISTENCY,
LIBTSB_SEV_ERROR,
"A <comment> object must have the required attributes 'tsb:contributor' and "
"'tsb:number', and may have the optional attribute 'tsb:point'. No other "
"attributes from the SBML Level 3 Test SB XML Library namespaces are "
"permitted on a <comment> object. ",
"'tsb:number', and may have the optional attributes 'tsb:point' and "
"'tsb:metaid'. No other attributes from the TSB Level 1 Version 1 "
"namespaces are permitted on a <comment> object. ",
{ "L3V1 Tsb V1 Section"
}
},

// 20304
// 20302
{ TsbCommentContributorMustBeString,
"The 'contributor' attribute must be String.",
LIBTSB_CAT_GENERAL_CONSISTENCY,
Expand All @@ -470,7 +469,7 @@ static const tsbErrorTableEntry tsbErrorTable[] =
}
},

// 20305
// 20303
{ TsbCommentNumberMustBeDouble,
"The 'number' attribute must be Double.",
LIBTSB_CAT_GENERAL_CONSISTENCY,
Expand All @@ -481,7 +480,7 @@ static const tsbErrorTableEntry tsbErrorTable[] =
}
},

// 20306
// 20304
{ TsbCommentPointMustBeString,
"The 'point' attribute must be String.",
LIBTSB_CAT_GENERAL_CONSISTENCY,
Expand Down
82 changes: 35 additions & 47 deletions deviser/pytest_files/test_other_library/test_other_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def teardown():
shutil.rmtree(temp_dir)


# @pytest.mark.parametrize('name, num, class_name, test_case, list_of', [
@pytest.mark.parametrize('name, num, class_name, test_case, list_of', [
# ('test_sedml', 1, 'SedModel', 'model', 'SedListOfModels'),
# ('test_sedml', 0, 'SedDocument', 'document', ''),
# ('test_sedml', 3, 'SedAddXML', 'xmlnode used', ''),
Expand All @@ -44,48 +44,38 @@ def teardown():
# 'SedListOfOutputs'),
# ('combine-archive', 0, 'CaContent', 'check includes', 'CaListOfContents'),
# ('combine-archive', 1, 'CaOmexManifest', 'document', ''),
# ('testsbxml', 1, 'TSBComment', 'comment class', 'TSBListOfComments'),
# ('testsbxml', 0, 'TSBDocument', 'document', ''),
# ])
# def test_cpp(name, num, class_name, test_case, list_of):
# """
# Run the C++ file tests.
#
# :param name: name of test group e.g. 'test_sedml', 'combine-archive'.
# :param num: list index, so we only generate a
# particular class, not all of them
# :param class_name: name of C++ class (and thus .cpp/.h filenames),
# e.g. 'CaContent'
# :param test_case: brief test description
# :param list_of: class name (and thus filenames) of any corresponding
# "list of" class, e.g. 'CaListOfContents'
# """
# gv.reset()
# xml_filename = functions.set_up_test(name, class_name, test_case)
# assert xml_filename is not None and xml_filename != ""
# test_utils.generate_new_cpp_header(xml_filename, num)
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
# if len(list_of) > 0:
# class_name = list_of
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
#
('testsbxml', 1, 'TSBComment', 'comment class', 'TSBListOfComments'),
('testsbxml', 0, 'TSBDocument', 'document', ''),
])
def test_cpp(name, num, class_name, test_case, list_of):
"""
Based on old test_utils.run_templates() function. Run the 'template' file tests.
:param name: name of test group e.g. 'test_sedml', 'combine-archive'.
:param class_name: name of C++ class (and thus .cpp/.h filenames),
e.g. 'SedBase'
:param test_case: brief test description, e.g. 'templates'.
:param list_of: class name (and thus filenames) of any corresponding
"list of" class, e.g. 'SedListOf'
"""
# gv.reset()
# xml_filename = functions.set_up_test(name, class_name, test_case)
# assert xml_filename is not None and xml_filename != ""
# test_utils.generate_new_cpp_header(xml_filename, num)
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
# if len(list_of) > 0:
# class_name = list_of
# assert 0 == test_utils.compare_code_headers(class_name)
# assert 0 == test_utils.compare_code_impl(class_name)
print('skip')


@pytest.mark.parametrize('name, class_name, test_case, list_of', [
# ('test_sedml', 'SedBase', 'templates', 'SedListOf'),
# ('combine-archive', 'CaBase', 'templates', 'CaListOf'),
# # Tests from old test_utils.testCombine()
# ('test_sedml', 'SedBase', 'templates', 'SedListOf'),
# ('combine-archive', 'CaBase', 'templates', 'CaListOf'),
('testsbxml', 'TSBBase', 'templates', 'TSBListOf'),
('testsbxml', 'TSBConstructorException', 'templates', ''),
('testsbxml', 'TSBReader', 'templates', ''),
('testsbxml', 'TSBWriter', 'templates', ''),
('testsbxml', 'TSBErrorLog', 'templates', ''),
('testsbxml', 'TSBNamespaces', 'templates', ''),
('testsbxml', 'TSBError', 'templates', ''),
('testsbxml', 'TSBVisitor', 'templates', ''),
('testsbxml', 'TSBTypeCodes', 'templates', ''),
('testsbxml', 'TSBTypes', 'templates', ''),
# ('testsbxml', 'TSBErrorTable', 'templates', '')
])
def test_templates(name, class_name, test_case, list_of):
"""
Expand All @@ -103,13 +93,11 @@ def test_templates(name, class_name, test_case, list_of):
assert xml_filename is not None and xml_filename != ""
test_utils.generate_templates(xml_filename)
assert 0 == test_utils.compare_code_headers(class_name)
if class_name != 'TSBTypes' and class_name != 'TSBErrorTable':
assert 0 == test_utils.compare_code_impl(class_name)
if list_of:
assert 0 == test_utils.compare_code_headers(list_of)
assert 0 == test_utils.compare_code_impl(list_of)
#
#
assert 0 == test_utils.compare_code_impl(class_name)
assert 0 == test_utils.compare_code_headers(list_of)
assert 0 == test_utils.compare_code_impl(list_of)


# @pytest.mark.parametrize('name, class_name, test_case, prefix, lib', [
# ('test_sedml', 'SedBase', 'common', 'Sed', 'sedml'),
# ('combine-archive', 'CaBase', 'common', 'Ca', 'combine'),
Expand Down

0 comments on commit 99796d3

Please sign in to comment.