def test_build_nightly_dict(self): nightly_dict = document_datasets._build_nightly_dict( # Registered datasets document_datasets._full_names_to_dict([ 'ds_same/config/1.0.0', 'ds_with_config/config_new/2.0.0', # Added config 'ds_with_config/config_same/2.0.0', # Added version 'ds_with_config/config_same/1.0.0', 'ds_new/1.0.0', # Added dataset 'ds_changed/2.0.0', # Added version 'ds_changed/1.0.0', 'ds_type/config/1.0.0', # `ds/version` -> `ds/config/version` ]), # Stable datasets document_datasets._full_names_to_dict([ 'ds_same/config/1.0.0', 'ds_with_config/config_same/1.0.0', 'ds_with_config/config_same/0.0.0', # Removed version 'ds_with_config/config_removed/1.0.0', # Removed config 'ds_changed/1.0.0', 'ds_changed/0.0.0', # Removed version 'ds_removed/1.0.0', # Removed dataset', 'ds_type/1.0.0', # `ds/version` -> `ds/config/version` ]), ) # Check that the added datasets, config, versions are marked as nightly self.assertEqual( nightly_dict, { 'ds_with_config': { 'config_new': True, 'config_same': { '2.0.0': True, '1.0.0': False, }, }, 'ds_new': True, 'ds_changed': { '': { '2.0.0': True, '1.0.0': False, }, }, 'ds_same': { 'config': { '1.0.0': False } }, 'ds_type': { 'config': True }, })
def test_full_names_to_dict(self): full_names_dict = document_datasets._full_names_to_dict([ 'ds1/c1/1.0.0', 'ds1/c1/2.0.0', 'ds1/c2/2.0.0', 'ds2/1.0.0', 'ds2/2.0.0', ]) self.assertEqual(full_names_dict, { 'ds1': { 'c1': {'1.0.0', '2.0.0'}, 'c2': {'2.0.0'}, }, 'ds2': { '': {'1.0.0', '2.0.0'} } })