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

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