[bfdf16]: / Tests / test_compare.py

Download this file

95 lines (72 with data), 3.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import pytest
try:
from pytest_h5compare import assert_compare_info
except ImportError:
pytestmark = pytest.mark.skipif(True, reason="Missing pytest_h5compare plugin.")
def test_Base(compare_regex, make_anytest_record):
pattern = r"Output:()|(Epot)|(Ekin)|(Emech)|(Pmech)|(MaxMuscleActivity)"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Pos(compare_regex, make_anytest_record):
pattern = r"Output/.*((/r$)|(/Axes$)|(/sRel$)|(Pos$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Vel(compare_regex, make_anytest_record):
pattern = r"Output/.*((/rDot$)|(/omega$)|(Vel$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Acc(compare_regex, make_anytest_record):
pattern = r"Output/.*((/rDDot$)|(/omegaDot$)|(Acc$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Fin(compare_regex, make_anytest_record):
pattern = r"Output/.*((/Fin$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Fout(compare_regex, make_anytest_record):
pattern = r"Output/.*((/Fout$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Activity(compare_regex, make_anytest_record):
pattern = r"Output/.*((/Activity$))"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Muscles(compare_regex, make_anytest_record):
pattern = (
r"Output/.*((/Activity$)|(/CorrectedActivity$)|(/Fm$)|(/Ft$)"
r"|(/Fp$)|(/Strength$)|(/Ft0$)|(/Ft0Grad$)|(/PennationAngle$)"
r"|(/EPOTt$)|(/EPOTp$)|(/EPOTmt$)|(/Pt$)|(/Pm$)|(/Pmet$))"
)
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_Contact(compare_regex, make_anytest_record):
pattern = (
r"Output/.*((/Fmaster$)|(/Fslave$)|(/Mmaster$)|(/Mslave$)"
r"|(/MCOP$)|(/COP$)|(/ContactArea$)|(/MaxPenetration$))"
)
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)
def test_SelOut(compare_regex, make_anytest_record):
pattern = r"Output/.*?/SelectedOutput/.*"
failed, total = compare_regex(pattern, atol=1e-6, rtol=1e-8)
for item in failed:
make_anytest_record(item)
assert_compare_info(failed, total)