File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -51,3 +51,4 @@ v1.0.0 will be the first stable release of the CellEngine Python Toolkit.
51
51
permissions required for some operations.
52
52
* All tests now run against a real CellEngine instance instead of using mocks,
53
53
avoiding bugs due to stale mocks.
54
+ * Support for ` experiment.save_revision() ` .
Original file line number Diff line number Diff line change @@ -365,6 +365,15 @@ def undelete(self) -> None:
365
365
self .deleted = None
366
366
ce .APIClient ().update_experiment (self ._id , {"deleted" : self .deleted })
367
367
368
+ def save_revision (self , description : str ) -> None :
369
+ """
370
+ Saves a revision of the experiment. The new revision will be the last
371
+ entry in the `revisions` property.
372
+ """
373
+ r = ce .APIClient ().save_experiment_revision (self ._id , description )
374
+ self ._properties ["revisions" ] = r .get ("revisions" )
375
+ self ._properties ["deepUpdated" ] = r .get ("deepUpdated" )
376
+
368
377
# Attachments
369
378
370
379
@property
Original file line number Diff line number Diff line change @@ -352,6 +352,12 @@ def delete_experiment(self, _id):
352
352
"""
353
353
self ._delete (f"{ self .base_url } /api/v1/experiments/{ _id } " )
354
354
355
+ def save_experiment_revision (self , _id , description : str ) -> Dict :
356
+ return self ._post (
357
+ f"{ self .base_url } /api/v1/experiments/{ _id } /revision" ,
358
+ json = {"description" : description },
359
+ )
360
+
355
361
# ------------------------------- FCS Files --------------------------------
356
362
357
363
def get_fcs_files (self , experiment_id , as_dict = False ) -> List [FcsFile ]:
Original file line number Diff line number Diff line change @@ -111,6 +111,14 @@ def test_experiment_clone(blank_experiment: Experiment):
111
111
assert exp .name == blank_experiment .name + "-1"
112
112
113
113
114
+ def test_save_revision (blank_experiment ):
115
+ preDU = blank_experiment .deep_updated
116
+ blank_experiment .save_revision ("my description" )
117
+ assert len (blank_experiment .revisions ) == 1
118
+ assert blank_experiment .revisions [0 ].get ("description" ) == "my description"
119
+ assert blank_experiment .deep_updated > preDU
120
+
121
+
114
122
def test_experiment_upload_fcs_file (blank_experiment : Experiment ):
115
123
file = blank_experiment .upload_fcs_file (
116
124
"tests/data/Specimen_001_A1_A01_MeOHperm(DL350neg).fcs"
You can’t perform that action at this time.
0 commit comments