Beispiel #1
0
def test_project_emptygraph():
    # creating project without parameters
    proj = Project(empty_graph=True)

    # checking if we created ProvDocument
    assert type(proj.bundle) is prov.model.ProvDocument

    # checking graph namespace
    namesp = [i.prefix for i in proj.graph.namespaces]
    assert namesp == ["nidm"]

    # checking type
    proj_type = proj.get_type()
    assert eval(proj_type.provn_representation()) == 'prov:Activity'

    assert len(proj.graph.get_records()) == 1
Beispiel #2
0
def test_project_noparameters():
    # creating project without parameters
    proj = Project()

    # checking if we created ProvDocument
    assert type(proj.bundle) is Constants.NIDMDocument
    assert issubclass(type(proj.bundle), prov.model.ProvDocument)

    # checking graph namespace
    const_l = list(Constants.namespaces)
    namesp = [i.prefix for i in proj.graph.namespaces]
    assert sorted(const_l) == sorted(namesp)

    # checking type
    proj_type = proj.get_type()
    assert eval(proj_type.provn_representation()) == 'prov:Activity'

    # checking length of graph records; it doesn work if all tests are run
    assert len(proj.graph.get_records()) == 1
Beispiel #3
0
def test_project_att():
    # creating project without parameters
    proj = Project(
        attributes={
            prov.model.QualifiedName(Constants.NIDM, "title"): "MyPRoject"
        })

    # checking if we created ProvDocument
    assert type(proj.bundle) is Constants.NIDMDocument
    assert issubclass(type(proj.bundle), prov.model.ProvDocument)

    # checking graph namespace
    const_l = list(Constants.namespaces)
    namesp = [i.prefix for i in proj.graph.namespaces]
    assert sorted(const_l +
                  [rdflib.term.URIRef('http://purl.org/nidash/nidm#prefix')]
                  ) == sorted(namesp)

    # checking type
    proj_type = proj.get_type()
    assert eval(proj_type.provn_representation()) == 'prov:Activity'

    # checking length of graph records; it doesn work if all tests are run
    assert len(proj.graph.get_records()) == 1