Beispiel #1
0
 def test_01(self):
     nrecords = 15
     name = "example_fofn"
     f = get_temp_file(name)
     _ = M.write_random_fofn(f, nrecords)
     ds_metadata = dispatch_metadata_resolver(self.FILE_TYPE, f)
     self.assertEquals(ds_metadata.nrecords, nrecords)
     os.remove(f)
Beispiel #2
0
def get_dataset_metadata_from_file(file_type, path, attribute_name):

    if attribute_name not in DatasetMetadata.SUPPORTED_ATTRS:
        raise InvalidDependencyInjectError("File metadata Attribute '{a}' is not support in {p}".format(a=attribute_name, p=path))

    dataset_metadata = dispatch_metadata_resolver(file_type, path)

    return getattr(dataset_metadata, attribute_name)
Beispiel #3
0
def get_dataset_metadata_from_file(file_type, path, attribute_name):

    if attribute_name not in DatasetMetadata.SUPPORTED_ATTRS:
        raise InvalidDependencyInjectError("File metadata Attribute '{a}' is not support in {p}".format(a=attribute_name, p=path))

    dataset_metadata = dispatch_metadata_resolver(file_type, path)

    return getattr(dataset_metadata, attribute_name)
Beispiel #4
0
 def test_01(self):
     p = get_temp_file(self.FILE_NAME)
     self._write_mock_file(p)
     ds_metadata = dispatch_metadata_resolver(self.FILE_TYPE, p)
     self.assertIsInstance(ds_metadata, DatasetMetadata)
     self.assertEquals(ds_metadata.nrecords, self.NRECORDS)