Commit 75ef5aab authored by Yannick DAYER's avatar Yannick DAYER

Add a test for the pad gen command

parent 73c6a864
claimed_id,test_label,is_bonafide,attack_type,sample_n,score
0,client/real/000,True,,0,11.764052345967665
0,client/real/000,True,,1,10.400157208367224
1,client/real/001,True,,0,10.97873798410574
1,client/real/001,True,,1,12.240893199201459
2,client/real/002,True,,0,11.867557990149967
2,client/real/002,True,,1,9.02272212012359
3,client/real/003,True,,0,10.95008841752559
3,client/real/003,True,,1,9.848642791702302
4,client/real/004,True,,0,9.896781148206442
4,client/real/004,True,,1,10.410598501938372
5,client/real/005,True,,0,10.144043571160879
5,client/real/005,True,,1,11.454273506962975
6,client/real/006,True,,0,10.761037725146993
6,client/real/006,True,,1,10.121675016492828
7,client/real/007,True,,0,10.443863232745425
7,client/real/007,True,,1,10.333674327374267
8,client/real/008,True,,0,11.494079073157605
8,client/real/008,True,,1,9.794841736234199
9,client/real/009,True,,0,10.313067701650901
9,client/real/009,True,,1,9.145904260698275
0,client/attack/000,False,type_0,0,6.447010184165921
0,client/attack/000,False,type_0,1,9.65361859544036
1,client/attack/001,False,type_0,0,9.864436198859506
1,client/attack/001,False,type_0,1,8.257834979593557
2,client/attack/002,False,type_0,0,11.269754623987607
2,client/attack/002,False,type_0,1,7.5456343254012355
3,client/attack/003,False,type_0,0,9.045758517301445
3,client/attack/003,False,type_0,1,8.812816149974166
4,client/attack/004,False,type_0,0,10.532779214358458
4,client/attack/004,False,type_0,1,10.469358769900285
5,client/attack/005,False,type_0,0,9.154947425696916
5,client/attack/005,False,type_0,1,9.378162519602174
6,client/attack/006,False,type_0,0,8.112214252369887
6,client/attack/006,False,type_0,1,7.019203531776073
7,client/attack/007,False,type_0,0,8.652087850673848
7,client/attack/007,False,type_0,1,9.15634896910398
8,client/attack/008,False,type_0,0,10.230290680727721
8,client/attack/008,False,type_0,1,10.20237984878441
9,client/attack/009,False,type_0,0,8.612673182592047
9,client/attack/009,False,type_0,1,8.697697249424664
0,client/attack/000,False,type_1,0,4.951447034932907
0,client/attack/000,False,type_1,1,4.579982062821025
1,client/attack/001,False,type_1,0,4.293729809374987
1,client/attack/001,False,type_1,1,7.95077539523179
2,client/attack/002,False,type_1,0,5.490347818248346
2,client/attack/002,False,type_1,1,5.561925698388814
3,client/attack/003,False,type_1,0,4.747204639950073
3,client/attack/003,False,type_1,1,6.77749035583191
4,client/attack/004,False,type_1,0,4.3861021524420485
4,client/attack/004,False,type_1,1,5.787259719786031
5,client/attack/005,False,type_1,0,5.104533438806325
5,client/attack/005,False,type_1,1,6.386902497859262
6,client/attack/006,False,type_1,0,5.489194862431127
6,client/attack/006,False,type_1,1,4.8193678158775874
7,client/attack/007,False,type_1,0,5.971817771661345
7,client/attack/007,False,type_1,1,6.4283318705304175
8,client/attack/008,False,type_1,0,6.066517222383168
8,client/attack/008,False,type_1,1,6.302471897739782
9,client/attack/009,False,type_1,0,5.3656779063190365
9,client/attack/009,False,type_1,1,5.6372588340128615
claimed_id,test_label,is_bonafide,attack_type,sample_n,score
0,client/real/000,True,,0,9.32753955222405
0,client/real/000,True,,1,9.640446838459459
1,client/real/001,True,,0,9.186853717955547
1,client/real/001,True,,1,8.273717397668323
2,client/real/002,True,,0,10.177426142253752
2,client/real/002,True,,1,9.598219063791738
3,client/real/003,True,,0,8.369801653033955
3,client/real/003,True,,1,10.462782255525774
4,client/real/004,True,,0,9.092701635616757
4,client/real/004,True,,1,10.051945395796139
5,client/real/005,True,,0,10.729090562177538
5,client/real/005,True,,1,10.128982910757411
6,client/real/006,True,,0,11.1394006845433
6,client/real/006,True,,1,8.765174179646348
7,client/real/007,True,,0,10.402341641177548
7,client/real/007,True,,1,9.315189909059686
8,client/real/008,True,,0,9.129202850818118
8,client/real/008,True,,1,9.421150335235584
9,client/real/009,True,,0,9.688447467872628
9,client/real/009,True,,1,10.056165342229745
0,client/attack/000,False,type_0,0,7.834850159216644
0,client/attack/000,False,type_0,1,9.900826486954188
1,client/attack/001,False,type_0,0,9.46566243973046
1,client/attack/001,False,type_0,1,7.463756313722776
2,client/attack/002,False,type_0,0,10.4882521937956
2,client/attack/002,False,type_0,1,10.895889176030582
3,client/attack/003,False,type_0,0,10.178779571159652
3,client/attack/003,False,type_0,1,8.82007516418765
4,client/attack/004,False,type_0,0,7.929247378489458
4,client/attack/004,False,type_0,1,10.054451726931136
5,client/attack/005,False,type_0,0,8.59682305302682
5,client/attack/005,False,type_0,1,10.222445070382427
6,client/attack/006,False,type_0,0,9.20827497807686
6,client/attack/006,False,type_0,1,9.976639036483713
7,client/attack/007,False,type_0,0,9.356366397174401
7,client/attack/007,False,type_0,1,9.706573168191948
8,client/attack/008,False,type_0,0,9.010500020720821
8,client/attack/008,False,type_0,1,10.785870493905835
9,client/attack/009,False,type_0,0,9.12691209270362
9,client/attack/009,False,type_0,1,9.401989363444702
0,client/attack/000,False,type_1,0,7.883150697056254
0,client/attack/000,False,type_1,1,4.652240938857553
1,client/attack/001,False,type_1,0,4.729515001514266
1,client/attack/001,False,type_1,1,6.969396708158011
2,client/attack/002,False,type_1,0,4.8268765948858405
2,client/attack/002,False,type_1,1,7.943621185649293
3,client/attack/003,False,type_1,0,5.586381019240252
3,client/attack/003,False,type_1,1,5.2525451885592425
4,client/attack/004,False,type_1,0,7.922942026480385
4,client/attack/004,False,type_1,1,7.480514791434424
5,client/attack/005,False,type_1,0,7.86755896042657
5,client/attack/005,False,type_1,1,6.906044658275385
6,client/attack/006,False,type_1,0,5.138774314945297
6,client/attack/006,False,type_1,1,7.910064953099034
7,client/attack/007,False,type_1,0,5.73199662904862
7,client/attack/007,False,type_1,1,6.802456395796395
8,client/attack/008,False,type_1,0,6.947251967773748
8,client/attack/008,False,type_1,1,5.8449899069091655
9,client/attack/009,False,type_1,0,6.61407937034608
9,client/attack/009,False,type_1,1,6.922206671566527
......@@ -2,6 +2,44 @@ from click.testing import CliRunner
import pkg_resources
from ..script import pad_commands
from bob.extension.scripts.click_helper import assert_click_runner_result
import os
def test_gen_pad():
dev_ref_file = pkg_resources.resource_filename(
"bob.pad.base.test", "data/csv_scores/scores-dev.csv"
)
eval_ref_file = pkg_resources.resource_filename(
"bob.pad.base.test", "data/csv_scores/scores-eval.csv"
)
with open(dev_ref_file, "r") as f:
dev_ref = f.readlines()
with open(eval_ref_file, "r") as f:
eval_ref = f.readlines()
runner = CliRunner()
with runner.isolated_filesystem():
cwd = "./"
result = runner.invoke(
pad_commands.gen,
[
cwd,
"--mean-match",
"10",
"--mean-attacks",
"9",
"--mean-attacks",
"6",
"--n-attacks",
"2",
],
)
assert_click_runner_result(result)
with open(os.path.join(cwd, "scores-dev.csv"), "r") as f:
for generated_line, reference in zip(f.readlines(), dev_ref):
assert generated_line == reference
with open(os.path.join(cwd, "scores-eval.csv"), "r") as f:
for generated_line, reference in zip(f.readlines(), eval_ref):
assert generated_line == reference
def test_det_pad():
......
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