Commit 7da63ac2 authored by André Anjos's avatar André Anjos 💬
Browse files

Add more tests

parent c0ee9796
Pipeline #6652 passed with stages
in 2 minutes and 30 seconds
...@@ -110,7 +110,7 @@ class Interface(BaseInterface): ...@@ -110,7 +110,7 @@ class Interface(BaseInterface):
parser.add_argument('-e', '--extension', default='', help="if given, this extension will be appended to every entry returned.") parser.add_argument('-e', '--extension', default='', help="if given, this extension will be appended to every entry returned.")
parser.add_argument('-p', '--protocol', help="if given, limits the dump to a particular subset of the data that corresponds to the given protocol.", choices=db.protocol_names() if db.is_valid() else ()) parser.add_argument('-p', '--protocol', help="if given, limits the dump to a particular subset of the data that corresponds to the given protocol.", choices=db.protocol_names() if db.is_valid() else ())
parser.add_argument('-u', '--purpose', help="if given, this value will limit the output files to those designed for the given purposes.", choices=db.purposes() if db.is_valid() else ()) parser.add_argument('-u', '--purpose', help="if given, this value will limit the output files to those designed for the given purposes.", choices=db.purposes() if db.is_valid() else ())
parser.add_argument('-m', '--models', type=str, help="if given, limits the dump to a particular model") parser.add_argument('-m', '--models', type=int, help="if given, limits the dump to a particular model")
parser.add_argument('-g', '--group', help="if given, this value will limit the output files to those belonging to a particular protocolar group.", choices=db.groups() if db.is_valid() else ()) parser.add_argument('-g', '--group', help="if given, this value will limit the output files to those belonging to a particular protocolar group.", choices=db.groups() if db.is_valid() else ())
parser.add_argument('-c', '--class', dest='sclass', help="if given, this value will limit the output files to those belonging to the given classes.", choices=('client', 'impostor')) parser.add_argument('-c', '--class', dest='sclass', help="if given, this value will limit the output files to those belonging to the given classes.", choices=('client', 'impostor'))
parser.add_argument('--self-test', dest="selftest", action='store_true', help=argparse.SUPPRESS) parser.add_argument('--self-test', dest="selftest", action='store_true', help=argparse.SUPPRESS)
......
...@@ -12,6 +12,8 @@ from .query import Database ...@@ -12,6 +12,8 @@ from .query import Database
import nose.tools import nose.tools
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
DATABASE_PATH = '/idiap/project/3dfingervein/database'
def metadata_available(test): def metadata_available(test):
"""Decorator for detecting if the metadata is available""" """Decorator for detecting if the metadata is available"""
...@@ -111,25 +113,23 @@ def test_central(): ...@@ -111,25 +113,23 @@ def test_central():
assert len(set(train_samples+dev_enroll_samples+dev_probe_samples)) == 4538 assert len(set(train_samples+dev_enroll_samples+dev_probe_samples)) == 4538
@nose.tools.nottest
@metadata_available @metadata_available
def test_driver_api(): def test_driver_api():
from bob.db.base.script.dbmanage import main from bob.db.base.script.dbmanage import main
nose.tools.eq_(main('fv3d dumplist --self-test'.split()), 0) nose.tools.eq_(main('fv3d dumplist --self-test'.split()), 0)
nose.tools.eq_(main('fv3d dumplist --protocol=Full --group=dev --purpose=enroll --model=101_L_1 --self-test'.split()), 0) nose.tools.eq_(main('fv3d dumplist --protocol=central --group=dev --purpose=enroll --model=1 --self-test'.split()), 0)
nose.tools.eq_(main('fv3d checkfiles --self-test'.split()), 0) nose.tools.eq_(main('fv3d checkfiles --self-test'.split()), 0)
@nose.tools.nottest
@metadata_available @metadata_available
@db_available @db_available
def test_load(): def test_load():
db = Database() db = Database()
for f in db.objects(): for f in db.objects()[:5]:
# loads an image from the database # loads an image from the database
image = f.load(DATABASE_PATH) image = f.load(DATABASE_PATH)
...@@ -138,12 +138,11 @@ def test_load(): ...@@ -138,12 +138,11 @@ def test_load():
nose.tools.eq_(image.dtype, numpy.uint8) nose.tools.eq_(image.dtype, numpy.uint8)
@nose.tools.nottest
@metadata_available @metadata_available
def test_model_id_to_finger_name_conversion(): def test_model_id_to_finger_name_conversion():
db = Database() db = Database()
for f in db.objects(): for k in db.model_ids()[:5]:
assert len(db.finger_name_from_model_id(f.model_id)) == 5 assert len(db.finger_name_from_model_id(k)) == 6
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment