Belle II Software
development
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
Enumerator
c
d
f
p
t
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
test_check_basf2_file.py
1
#!/usr/bin/env python3
2
3
10
11
import
os
12
13
# Test redirect_stdout, as we use that in b2file-check
14
from
contextlib
import
redirect_stdout
15
with
redirect_stdout(open(os.devnull,
'w'
)):
16
print(
'abc'
)
17
18
import
basf2
# noqa
19
20
21
rootfile = basf2.find_file(
'/framework/tests/root_input.root'
)
22
assert
0 == os.system(
'b2file-check '
+ rootfile)
23
24
assert
0 != os.system(
'b2file-check /THIS_DOESNT_EXIST'
)
25
assert
0 != os.system(
'b2file-check /dev/null'
)
26
27
28
assert
0 == os.system(
'b2file-check -n 5 '
+ rootfile)
29
assert
0 == os.system(
'b2file-check --events 5 '
+ rootfile)
30
assert
0 != os.system(
'b2file-check -n 10 '
+ rootfile)
31
32
assert
0 == os.system(
'b2file-check --mcevents 5 '
+ rootfile)
33
assert
0 != os.system(
'b2file-check --mcevents 0 '
+ rootfile)
34
35
assert
0 == os.system(
'b2file-check -n 5 -s 9.5 1 '
+ rootfile)
36
assert
0 == os.system(
'b2file-check -n 5 -s 9.5 0.05 '
+ rootfile)
37
assert
0 != os.system(
'b2file-check -n 5 -s 9.5 0 '
+ rootfile)
38
39
assert
0 == os.system(
'b2file-check -n 5 -s 10 1 '
+ rootfile)
40
assert
0 == os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile)
41
assert
0 == os.system(
'b2file-check -n 5 -s 10 0.2 '
+ rootfile)
42
assert
0 != os.system(
'b2file-check -n 5 -s 10 0.05 '
+ rootfile)
43
44
assert
0 == os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' EventMetaData'
)
45
allbranches =
'EventMetaData PXDClusters PXDClustersToPXDDigits PXDClustersToPXDTrueHits PXDDigits PXDTrueHits'
46
assert
0 == os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' '
+ allbranches)
47
assert
0 == os.system(
'b2file-check --json -n 5 -s 10 0.5 '
+ rootfile +
' '
+ allbranches)
48
49
assert
0 != os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' NotThere'
)
50
assert
0 != os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' EventMetaData NotThere'
)
51
assert
0 != os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' NotThere EventMetaData'
)
52
assert
0 != os.system(
'b2file-check -n 5 -s 10 0.5 '
+ rootfile +
' FileMetaData'
)
framework
tests
test_check_basf2_file.py
Generated on Wed Apr 9 2025 02:41:02 for Belle II Software by
1.9.6