Skip to content
Snippets Groups Projects
Commit 24f53216 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch 'noztfilelist' into 'master'

Test filelist databases when no zt files exist

See merge request !114
parents 45983b2d 6c92c1ce
No related branches found
No related tags found
1 merge request!114Test filelist databases when no zt files exist
Pipeline #
...@@ -10,6 +10,9 @@ from .. import BioFile ...@@ -10,6 +10,9 @@ from .. import BioFile
from .models import ListReader from .models import ListReader
import logging
logger = logging.getLogger('bob.bio.base')
class FileListBioDatabase(ZTBioDatabase): class FileListBioDatabase(ZTBioDatabase):
"""This class provides a user-friendly interface to databases that are given as file lists. """This class provides a user-friendly interface to databases that are given as file lists.
...@@ -226,10 +229,12 @@ class FileListBioDatabase(ZTBioDatabase): ...@@ -226,10 +229,12 @@ class FileListBioDatabase(ZTBioDatabase):
if group == 'world': if group == 'world':
continue continue
if add_zt_files: if add_zt_files:
if not self.implements_zt(self.protocol, group): if self.implements_zt(self.protocol, group):
raise ValueError("ZT score files are requested, but no such files are defined in group %s for protocol %s", group, self.protocol) files += self.tobjects(group, self.protocol)
files += self.tobjects(group, self.protocol) files += self.zobjects(group, self.protocol, **self.z_probe_options)
files += self.zobjects(group, self.protocol, **self.z_probe_options) else:
logger.warn("ZT score files are requested, but no such files are defined in group %s for protocol %s", group, self.protocol)
return self.sort(self._make_bio(files)) return self.sort(self._make_bio(files))
......
...@@ -136,6 +136,12 @@ def test_query_protocol(): ...@@ -136,6 +136,12 @@ def test_query_protocol():
assert len(db.objects(protocol=prot, groups='dev', purposes='probe')) == 9 assert len(db.objects(protocol=prot, groups='dev', purposes='probe')) == 9
def test_noztnorm():
db = FileListBioDatabase(os.path.join(os.path.dirname(example_dir),
'example_filelist2'), 'test')
assert len(db.all_files())
def test_query_dense(): def test_query_dense():
db = FileListBioDatabase(example_dir, 'test', use_dense_probe_file_list=True) db = FileListBioDatabase(example_dir, 'test', use_dense_probe_file_list=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment