incf-nidash / PyNIDM

Other
21 stars 31 forks source link

test_experimment is commented #83

Open djarecka opened 6 years ago

djarecka commented 6 years ago

the test_experiment is commented (https://github.com/incf-nidash/PyNIDM/blob/master/nidm/experiment/tests/test_experiment.py#L87).

It should be fixed

update in #88 I reverted changes test_experiment (so it runs again) and add pytest.skip to test_provone

djarecka commented 6 years ago

the test that shows the problem (from comments in #76)

from nidm.experiment import Project
from nidm.core import Constants

def test_pass():
    project = Project()
    project_PI = project.add_person()
    project.add_qualified_association(person=project_PI, role=Constants.NIDM_PI)

    with open("test.ttl",'w') as f:
        f.write (project.serializeTurtle())

def test_fail():
    # adding import                                                                                                                                             
    import nidm.core.provone

    project = Project()
    project_PI = project.add_person()
    project.add_qualified_association(person=project_PI, role=Constants.NIDM_PI)

    with open("test.ttl",'w') as f:
        f.write (project.serializeTurtle())
djarecka commented 6 years ago

@sanuann - have you had a chance to look at this? It would be good to bring the test_experiment back, since @dbkeator is adding things to experiment.

djarecka commented 6 years ago

@satra - this is the error you were asking me today:

_____________________________________________________________ test_fail _____________________________________________________________

    def test_fail():
        # adding import
        import nidm.core.provone

        project = Project()
        project_PI = project.add_person()#attributes={Constants.NIDM_FAMILY_NAME:"Keator", Constants.NIDM_GIVEN_NAME:"David"})
        project.add_qualified_association(person=project_PI,role=Constants.NIDM_PI)

        with open("test.ttl",'w') as f:
>           f.write (project.serializeTurtle())

nidm/experiment/tests/test_aexperiment_short.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nidm/experiment/Core.py:303: in serializeTurtle
    return self.graph.serialize(None, format='rdf', rdf_format='ttl')
../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/prov/model.py:2388: in serialize
    serializer.serialize(stream, **args)
../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/prov/serializers/provrdf.py:90: in serialize
    container = self.encode_document(self.document)
../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/prov/serializers/provrdf.py:196: in encode_document
    container = self.encode_container(document)
../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/prov/serializers/provrdf.py:351: in encode_container
    self.encode_rdf_representation(value)))
../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/rdflib/graph.py:1351: in add
    _assertnode(s,p,o)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

terms = (None, rdflib.term.URIRef('http://www.w3.org/ns/prov#activity'), rdflib.term.URIRef('http://purl.org/nidash/nidm#_88de2e28-950c-11e8-a0c8-14109fd3bef5'))
t = None

    def _assertnode(*terms):
        for t in terms:
            assert isinstance(t, Node), \
>               'Term %s must be an rdflib term' % (t,)
E           AssertionError: Term None must be an rdflib term

../anaconda/envs/pyndim_py3_pytest/lib/python3.6/site-packages/rdflib/graph.py:1945: AssertionError
djarecka commented 6 years ago

since this was not fixed I removed import of nidm.core.provone and skipped all tests for provone in #88.