本文整理汇总了Python中pyasdf.ASDFDataSet.add_provenance_document方法的典型用法代码示例。如果您正苦于以下问题:Python ASDFDataSet.add_provenance_document方法的具体用法?Python ASDFDataSet.add_provenance_document怎么用?Python ASDFDataSet.add_provenance_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasdf.ASDFDataSet
的用法示例。
在下文中一共展示了ASDFDataSet.add_provenance_document方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_str_method_provenance_documents
# 需要导入模块: from pyasdf import ASDFDataSet [as 别名]
# 或者: from pyasdf.ASDFDataSet import add_provenance_document [as 别名]
def test_str_method_provenance_documents(tmpdir):
asdf_filename = os.path.join(tmpdir.strpath, "test.h5")
data_set = ASDFDataSet(asdf_filename)
filename = os.path.join(data_dir, "example_schematic_processing_chain.xml")
data_set.add_provenance_document(filename, name="test_provenance")
assert str(data_set.provenance) == (
"1 Provenance Document(s):\n\ttest_provenance"
)
示例2: test_provenance_list_command
# 需要导入模块: from pyasdf import ASDFDataSet [as 别名]
# 或者: from pyasdf.ASDFDataSet import add_provenance_document [as 别名]
def test_provenance_list_command(tmpdir):
asdf_filename = os.path.join(tmpdir.strpath, "test.h5")
data_set = ASDFDataSet(asdf_filename)
filename = os.path.join(data_dir,
"example_schematic_processing_chain.xml")
# Add it as a document.
doc = prov.read(filename, format="xml")
data_set.add_provenance_document(doc, name="test_provenance")
assert data_set.provenance.list() == ["test_provenance"]
示例3: test_adding_a_provenance_record
# 需要导入模块: from pyasdf import ASDFDataSet [as 别名]
# 或者: from pyasdf.ASDFDataSet import add_provenance_document [as 别名]
def test_adding_a_provenance_record(tmpdir):
"""
Tests adding a provenance record.
"""
asdf_filename = os.path.join(tmpdir.strpath, "test.h5")
data_set = ASDFDataSet(asdf_filename)
filename = os.path.join(data_dir, "example_schematic_processing_chain.xml")
# Add it as a document.
doc = prov.read(filename, format="xml")
data_set.add_provenance_document(doc, name="test_provenance")
del data_set
# Read it again.
data_set = ASDFDataSet(asdf_filename)
assert data_set.provenance.test_provenance == doc
示例4: test_trying_to_add_provenance_record_with_invalid_name_fails
# 需要导入模块: from pyasdf import ASDFDataSet [as 别名]
# 或者: from pyasdf.ASDFDataSet import add_provenance_document [as 别名]
def test_trying_to_add_provenance_record_with_invalid_name_fails(tmpdir):
"""
The name must be valid according to a particular regular expression.
"""
asdf_filename = os.path.join(tmpdir.strpath, "test.h5")
data_set = ASDFDataSet(asdf_filename)
filename = os.path.join(data_dir, "example_schematic_processing_chain.xml")
# First try adding it as a prov document.
doc = prov.read(filename, format="xml")
with pytest.raises(ASDFValueError) as err:
data_set.add_provenance_document(doc, name="a-b-c")
assert err.value.args[0] == (
"Name 'a-b-c' is invalid. It must validate against the regular "
"expression '^[0-9a-z][0-9a-z_]*[0-9a-z]$'.")
# Must sometimes be called to get around some bugs.
data_set.__del__()