Commit 7b1c922f authored by Vincent Michel's avatar Vincent Michel

Fix non-bytes arguments

parent 0f2204e8
Pipeline #802 passed with stages
in 1 minute and 15 seconds
......@@ -88,7 +88,7 @@ def stop_run(channel):
def get_run_data_length(channel):
length = ffi.new('unsigned long *')
code = handel.xiaGetRunData(channel, 'mca_length', length)
code = handel.xiaGetRunData(channel, b'mca_length', length)
check_error(code)
return length[0]
......@@ -97,7 +97,7 @@ def get_run_data(channel):
length = get_run_data_length(channel)
array = numpy.zeros(length, dtype='uint')
data = ffi.cast('unsigned long *', array.ctypes.data)
code = handel.xiaGetRunData(channel, 'mca', data)
code = handel.xiaGetRunData(channel, b'mca', data)
check_error(code)
return array
......
......@@ -149,7 +149,7 @@ def test_get_run_data_length(interface):
assert interface.get_run_data_length(1) == 10
m.assert_called_once()
arg = m.call_args[0][2]
m.assert_called_once_with(1, 'mca_length', arg)
m.assert_called_once_with(1, b'mca_length', arg)
interface.check_error.assert_called_once_with(0)
......@@ -157,10 +157,10 @@ def test_get_run_data(interface):
m = interface.handel.xiaGetRunData
def side_effect(channel, dtype, arg):
if dtype == 'mca_length':
if dtype == b'mca_length':
arg[0] = 10
return 0
if dtype == 'mca':
if dtype == b'mca':
for x in range(10):
arg[x] = x
return 0
......@@ -172,7 +172,7 @@ def test_get_run_data(interface):
assert diff.all()
m.assert_called()
arg = m.call_args[0][2]
m.assert_called_with(1, 'mca', arg)
m.assert_called_with(1, b'mca', arg)
interface.check_error.assert_called_with(0)
......
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