From 242684a4e9de982e85e42e1f298871c7ee609263 Mon Sep 17 00:00:00 2001 From: vermeul <swen@ethz.ch> Date: Fri, 15 Dec 2017 16:39:46 +0100 Subject: [PATCH] experiment tests --- src/python/PyBis/pybis/pybis.py | 5 ++-- src/python/PyBis/tests/test_experiment.py | 34 ++++++++++------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/python/PyBis/pybis/pybis.py b/src/python/PyBis/pybis/pybis.py index 67ddb1d10e3..cb6f865dda0 100644 --- a/src/python/PyBis/pybis/pybis.py +++ b/src/python/PyBis/pybis/pybis.py @@ -3623,8 +3623,9 @@ class Experiment(OpenBisObject): # the list of possible methods/attributes displayed # when invoking TAB-completition return [ - 'permId', 'identifier', - 'props', 'space', 'project', + 'code', 'permId', 'identifier', + 'type', 'project', + 'props.', 'project', 'tags', 'attachments', 'data', 'get_datasets()', 'get_samples()', 'set_tags()', 'add_tags()', 'del_tags()', diff --git a/src/python/PyBis/tests/test_experiment.py b/src/python/PyBis/tests/test_experiment.py index cd102af4279..10ba05ef056 100644 --- a/src/python/PyBis/tests/test_experiment.py +++ b/src/python/PyBis/tests/test_experiment.py @@ -26,26 +26,20 @@ def test_create_delete_project(space): type='DEFAULT_EXPERIMENT', ) assert e_new.project is not None + assert e_new.permId is None + e_new.save() assert e_new.permId is not None - assert e_new.code == new_code - assert e_identifier == '/DEFAULT/DEFAULT/'+new_code - - - #project=o.new_project(space=space, code='illegal title contains spaces') - #with pytest.raises(ValueError): - # project.save() - # assert "should not have been created" is None - - #project_name = 'project_'+timestamp - #project=o.new_project(space=space, code=project_name) - #project.save() - - #project_exists=o.get_project(project_name) - #assert project_exists is not None - #project_exists.delete('test project on '+timestamp) - # - #with pytest.raises(ValueError): - # project_no_longer_exists=o.get_project(project_name) - # assert "project {} should have been deleted".format(project_name) is None + assert e_new.code == new_code.upper() + assert e_new.identifier == '/DEFAULT/DEFAULT/'+new_code.upper() + + e_exists = o.get_experiment('/DEFAULT/DEFAULT/'+new_code.upper()) + assert e_exists is not None + + e_new.delete('delete test experiment '+new_code.upper()) + + with pytest.raises(ValueError): + e_no_longer_exists = o.get_experiment('/DEFAULT/DEFAULT/'+new_code.upper()) + + -- GitLab