Skip to content

Improve array conversion from Java & add a test for nan and inf values from Java

Philip Elson requested to merge pelson/pyjapc:maint/testing_nan_and_inf into master

I couldn't reproduce the reported issue @rdemaria, and have added tests to confirm that it is doing as expected.

Just in case, I also went through the whole Japc machinery with the following test, and also couldn't find the issue:

def test_get_value_double(japc, japc_mock):
    param = 'TEST/TestProperty'
    mock = japc_mock.mockParameter(param)
    japc_mock.whenGetValueThen(
        mock, japc_mock.sel('LHC.USER.TEST'), japc_mock.acqVal(param, np.inf, 0))
    japc.setSelector('LHC.USER.TEST')
    assert np.isinf(japc.getParam('TEST/TestProperty'))

and:

def test_get_value_double(japc, japc_mock):
    param = 'TEST/TestProperty'
    mock = japc_mock.mockParameter(param)
    japc_mock.whenGetValueThen(
        mock, japc_mock.sel('LHC.USER.TEST'), japc_mock.acqVal(param, np.nan, 0))
    japc.setSelector('LHC.USER.TEST')
    assert np.isnan(japc.getParam('TEST/TestProperty'))
Edited by Philip Elson

Merge request reports