File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -184,11 +184,12 @@ def get_metadata(self, j):
184184 d [key ] = bool (d [key ])
185185 else :
186186 d [key ] = str (d [key ])
187- if self .date_field is None :
188- raise ValueError ("No date field set, cannot get metadata items" )
189- # For compatibility in the short term:
190- d ["date" ] = self .sample_date [j ]
191- d ["strain" ] = self .sample_id [j ]
187+ if self .date_field is not None :
188+ # For compatibility in the short term:
189+ d ["date" ] = self .sample_date [j ]
190+ # NOTE 'strain' will be removed
191+ # https://github.com/tskit-dev/sc2ts/issues/574
192+ d ["strain" ] = self .sample_id [j ]
192193 return d
193194
194195 def __getitem__ (self , key ):
Original file line number Diff line number Diff line change @@ -469,9 +469,8 @@ def test_known(self, fx_dataset):
469469
470470 def test_known_no_date_field (self , fx_dataset ):
471471 ds = sc2ts .Dataset (fx_dataset .path )
472-
473- with pytest .raises (ValueError , match = "No date field set" ):
474- ds .metadata ["SRR11772659" ]
472+ d = ds .metadata ["SRR11772659" ]
473+ assert "strain" not in d
475474
476475 @pytest .mark .parametrize (
477476 ["chunk_size" , "cache_size" ],
You can’t perform that action at this time.
0 commit comments