Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
cf9b205a
Commit
cf9b205a
authored
Nov 03, 2017
by
Vincent Michel
Browse files
Update tests
parent
3909c01d
Pipeline
#1295
passed with stages
in 1 minute and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
cf9b205a
...
...
@@ -14,9 +14,9 @@ from .parser import parse_xia_ini_file
from
.mapping
import
parse_mapping_buffer
__all__
=
[
'init'
,
'init_handel'
,
'exit'
,
'new_detector'
,
'get_num_detectors'
,
'get_detectors'
,
'get_num_detectors'
,
'get_detectors'
,
'get_detector_from_channel'
,
'start_run'
,
'stop_run'
,
'start_run'
,
'stop_run'
,
'get_channel_realtime'
,
'get_spectrum_length'
,
'get_spectrum'
,
'get_spectrums'
,
'is_channel_running'
,
'is_running'
,
'get_module_statistics'
,
'get_statistics'
,
...
...
@@ -32,11 +32,13 @@ __all__ = ['init', 'init_handel', 'exit',
'set_log_output'
,
'set_log_level'
,
'close_log'
,
'get_num_modules'
,
'get_modules'
,
'get_module_from_channel'
,
'get_module_type'
,
'get_module_interface'
,
'get_module_number_of_channels'
,
'get_module_channel_at'
,
'get_module_channels'
,
'get_grouped_channels'
,
'get_channels'
,
'get_trigger_channels'
,
'get_master_channels'
,
'get_trigger_channels'
,
'set_acquisition_value'
,
'get_acquisition_value'
,
'remove_acquisition_value'
,
'apply_acquisition_values'
,
'get_handel_version'
]
'get_handel_version'
,
'get_config_files'
,
'get_config'
]
MAX_STRING_LENGTH
=
80
...
...
tests/test_interface.py
View file @
cf9b205a
...
...
@@ -3,6 +3,7 @@ import numpy
import
mock
from
handel.stats
import
Stats
from
handel.error
import
HandelError
@
pytest
.
fixture
...
...
@@ -164,6 +165,22 @@ def test_stop_run(interface):
interface
.
check_error
.
assert_called_once_with
(
0
)
def
test_get_channel_realtime
(
interface
):
m
=
interface
.
handel
.
xiaGetRunData
def
side_effect
(
channel
,
dtype
,
arg
):
arg
[
0
]
=
1.23
return
0
m
.
side_effect
=
side_effect
assert
interface
.
get_channel_realtime
(
1
)
==
1.23
m
.
assert_called_once
()
arg
=
m
.
call_args
[
0
][
2
]
m
.
assert_called_once_with
(
1
,
b
'realtime'
,
arg
)
# Make sure errors have been checked
interface
.
check_error
.
assert_called_once_with
(
0
)
def
test_get_spectrum_length
(
interface
):
m
=
interface
.
handel
.
xiaGetRunData
...
...
@@ -297,12 +314,15 @@ def test_get_module_statistics(interface):
with
mock
.
patch
(
'handel.interface.get_spectrum'
)
as
m4
:
m2
.
return_value
=
[
-
1
,
-
1
,
-
1
,
8
]
m3
.
return_value
=
u
'falconxn'
m4
.
side_effect
=
HandelError
(
12
,
'hello'
)
# First test
assert
interface
.
get_module_statistics
(
'module3'
)
==
expected
m2
.
assert_called_once_with
(
'module3'
)
arg
=
m
.
call_args
[
0
][
2
]
m
.
assert_called_once_with
(
8
,
b
'module_statistics_2'
,
arg
)
m4
.
assert_called_once_with
(
8
)
# Second test
raw
[
5
]
=
4.56
# ICR inconsistency
raw
[
6
]
=
1.23
# OCR inconsistency
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment