Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.base
Merge requests
!38
Issue 8 remove database configuration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue 8 remove database configuration
issue-8-remove-database-configuration
into
master
Overview
0
Commits
3
Pipelines
1
Changes
2
Merged
Tiago de Freitas Pereira
requested to merge
issue-8-remove-database-configuration
into
master
8 years ago
Overview
0
Commits
3
Pipelines
1
Changes
2
Expand
Solving issue
#37 (closed)
(some database tests are missing)
1
0
Merge request reports
Viewing commit
4a1731f6
Prev
Next
Show latest version
2 files
+
29
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
4a1731f6
Turned lambda function into named function
· 4a1731f6
Manuel Günther
authored
8 years ago
bob/bio/base/test/test_database_implementations.py
0 → 100644
+
50
−
0
Options
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Amir Mohammadi <amir.mohammadi@idiap.ch>
# Wed 20 July 16:20:12 CEST 2016
#
"""
Very simple tests for Implementations
"""
import
os
from
bob.bio.base.database
import
BioDatabase
,
ZTBioDatabase
def
check_database
(
database
,
groups
=
(
'
dev
'
,),
protocol
=
None
,
training_depends
=
False
,
models_depend
=
False
):
assert
isinstance
(
database
,
BioDatabase
)
# load the directories
if
'
HOME
'
in
os
.
environ
:
database
.
replace_directories
(
os
.
path
.
join
(
os
.
environ
[
'
HOME
'
],
'
.bob_bio_databases.txt
'
))
if
protocol
:
database
.
protocol
=
protocol
if
protocol
is
None
:
protocol
=
database
.
protocol
assert
len
(
database
.
all_files
())
>
0
assert
len
(
database
.
training_files
(
'
train_extractor
'
))
>
0
assert
len
(
database
.
arrange_by_client
(
database
.
training_files
(
'
train_enroller
'
)))
>
0
for
group
in
groups
:
model_ids
=
database
.
model_ids_with_protocol
(
group
,
protocol
=
protocol
)
assert
len
(
model_ids
)
>
0
assert
database
.
client_id_from_model_id
(
model_ids
[
0
])
is
not
None
assert
len
(
database
.
enroll_files
(
model_ids
[
0
],
group
))
>
0
assert
len
(
database
.
probe_files
(
model_ids
[
0
],
group
))
>
0
assert
database
.
training_depends_on_protocol
==
training_depends
assert
database
.
models_depend_on_protocol
==
models_depend
def
check_database_zt
(
database
,
groups
=
(
'
dev
'
,
'
eval
'
),
protocol
=
None
,
training_depends
=
False
,
models_depend
=
False
):
check_database
(
database
,
groups
,
protocol
,
training_depends
,
models_depend
)
assert
isinstance
(
database
,
ZTBioDatabase
)
for
group
in
groups
:
t_model_ids
=
database
.
t_model_ids
(
group
)
assert
len
(
t_model_ids
)
>
0
assert
database
.
client_id_from_model_id
(
t_model_ids
[
0
])
is
not
None
assert
len
(
database
.
t_enroll_files
(
t_model_ids
[
0
],
group
))
>
0
assert
len
(
database
.
z_probe_files
(
group
))
>
0
Loading