當前位置: 首頁>>代碼示例>>Python>>正文


Python ASDFDataSet.add_provenance_document方法代碼示例

本文整理匯總了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"
    )
開發者ID:petrrr,項目名稱:pyasdf,代碼行數:12,代碼來源:test_asdf_data_set.py

示例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"]
開發者ID:petrrr,項目名稱:pyasdf,代碼行數:14,代碼來源:test_asdf_data_set.py

示例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
開發者ID:petrrr,項目名稱:pyasdf,代碼行數:19,代碼來源:test_asdf_data_set.py

示例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__()
開發者ID:petrrr,項目名稱:pyasdf,代碼行數:22,代碼來源:test_asdf_data_set.py


注:本文中的pyasdf.ASDFDataSet.add_provenance_document方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。