def test_error_rcm_pressurerise(self):
"""Test for appropriate error if RCM file has pressure rise.
"""
file_path = os.path.join('testfile_rcm.xml')
filename = pkg_resources.resource_filename(__name__, file_path)
# add pressure rise to common properties
tree = etree.parse(filename)
root = tree.getroot()
properties = root.find('commonProperties')
prop = etree.SubElement(properties, 'property')
prop.set('name', 'pressure rise')
prop.set('units', '1/ms')
prop_value = etree.SubElement(prop, 'value')
prop_value.text = '0.10'
# write new file, and try to load
et = etree.ElementTree(root)
with TemporaryDirectory() as temp_dir:
filename = os.path.join(temp_dir, 'test.xml')
et.write(filename, encoding='utf-8', xml_declaration=True)
with pytest.raises(KeywordError) as excinfo:
ReSpecTh_to_ChemKED(filename)
assert 'Pressure rise cannot be defined for RCM.' in str(excinfo.value)
评论列表
文章目录