test_files

wield.control.fitting.SISO.test.file_io.test_files

This is a pytest module needing documentation

pytest-html report

Functions

test_mat()

This is a pytest needing documentation

test_mat_struct()

This is a pytest needing documentation

test_mat_struct_RI()

This is a pytest needing documentation

test_mat_struct_RT()

This is a pytest needing documentation

Details

test_mat()[source][github]

This is a pytest needing documentation

code
1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
2def test_mat():
3    fname = matlab_test_data.matfiles["iir_test_vars.mat"]
4    fdict = matlab_io.load_matlab(fname)
5    fdict["F_Hz"]
6    assert fdict["xfer"].dtype == complex
7    fdict["SNR"]
8    assert fdict["noneA"] is None
9    assert fdict["noneC"] is None
pytest information

This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:

wield.control.fitting.SISO.test.file_io.test_files.test_mat

The full name is useful when building documentation, to link a reference to this page using :func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.

test_mat
output
status: passed
duration: 0.017s
test_mat_struct()[source][github]

This is a pytest needing documentation

code
1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
2def test_mat_struct():
3    fname = matlab_test_data.matfiles["iir_test_struct.mat"]
4    fdict = matlab_io.load_matlab(fname)
5    # pprint(fdict['data']['xfer'])
6    assert file_io.subkey_search(fdict, "data.xfer").dtype == complex
7    # pprint(fdict['data']['confuse'])
8    assert fdict["data"]["noneA"] is None
9    assert fdict["data"]["noneC"] is None
pytest information

This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:

wield.control.fitting.SISO.test.file_io.test_files.test_mat_struct

The full name is useful when building documentation, to link a reference to this page using :func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.

test_mat_struct
output
status: failed
duration: 0.003s
captured errors:
@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
    def test_mat_struct():
        fname = matlab_test_data.matfiles["iir_test_struct.mat"]
>       fdict = matlab_io.load_matlab(fname)

../../src/wield/control/fitting/SISO/test/file_io/test_files.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:52: in load_matlab
    d = squeezerec(None, d)
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:16: in squeezerec
    obj[k] = squeezerec(k, v)
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:35: in squeezerec
    d[name] = squeezerec(name, obj[name])
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:21: in squeezerec
    return squeezerec(None, obj.item())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

key = None
obj = array([array([1, 2], dtype=uint8), array([1, 2], dtype=object),
       array((1,), dtype=[('A', 'O')])], dtype=object)

    def squeezerec(key, obj):
        if isinstance(obj, dict):
            for k, v in list(obj.items()):
                obj[k] = squeezerec(k, v)
            return obj
        elif isinstance(obj, np.ndarray):
            if obj.dtype.names is None:
                if not obj.shape:
                    return squeezerec(None, obj.item())
                if obj.shape == (0,) or obj.shape == (0, 0):
                    return None
                else:
                    if obj.dtype == object:
                        lst = []
                        for idx, v in enumerate(obj):
                            lst.append(squeezerec(idx, v))
>                       return np.array(lst)
E                       ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:29: ValueError
test_mat_struct_RI()[source][github]

This is a pytest needing documentation

code
1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
2def test_mat_struct_RI():
3    fname = matlab_test_data.matfiles["iir_test_struct_RI.mat"]
4    fdict = matlab_io.load_matlab(fname)
5    # pprint(fdict)
pytest information

This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:

wield.control.fitting.SISO.test.file_io.test_files.test_mat_struct_RI

The full name is useful when building documentation, to link a reference to this page using :func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.

test_mat_struct_RI
output
status: passed
duration: 0.001s
test_mat_struct_RT()[source][github]

This is a pytest needing documentation

code
 1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
 2def test_mat_struct_RT():
 3    fname = matlab_test_data.matfiles["iir_test_struct.mat"]
 4    fdict = matlab_io.load_matlab(fname)
 5    test_path = path.split(__file__)[0]
 6    fpath = path.join(test_path, "iir_test_struct_RT.mat")
 7    matlab_io.write_matlab(fpath, fdict)
 8    fdict2 = matlab_io.load_matlab(fpath)
 9
10    assert np.all(fdict["data"]["F_Hz"] == fdict2["data"]["F_Hz"])
11    assert np.all(fdict["data"]["xfer"] == fdict2["data"]["xfer"])
12    assert np.all(fdict["data"]["SNR"] == fdict2["data"]["SNR"])
13    assert np.all(fdict["data"]["noneA"] == fdict2["data"]["noneA"])
14    assert np.all(fdict["data"]["noneC"] == fdict2["data"]["noneC"])
15    print(str(fdict["data"]["confuse"]))
16    print(str(fdict2["data"]["confuse"]))
17    assert str(fdict["data"]["confuse"]) == str(fdict2["data"]["confuse"])
pytest information

This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:

wield.control.fitting.SISO.test.file_io.test_files.test_mat_struct_RT

The full name is useful when building documentation, to link a reference to this page using :func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.

test_mat_struct_RT
output
status: failed
duration: 0.001s
captured errors:
@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
    def test_mat_struct_RT():
        fname = matlab_test_data.matfiles["iir_test_struct.mat"]
>       fdict = matlab_io.load_matlab(fname)

../../src/wield/control/fitting/SISO/test/file_io/test_files.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:52: in load_matlab
    d = squeezerec(None, d)
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:16: in squeezerec
    obj[k] = squeezerec(k, v)
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:35: in squeezerec
    d[name] = squeezerec(name, obj[name])
/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:21: in squeezerec
    return squeezerec(None, obj.item())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

key = None
obj = array([array([1, 2], dtype=uint8), array([1, 2], dtype=object),
       array((1,), dtype=[('A', 'O')])], dtype=object)

    def squeezerec(key, obj):
        if isinstance(obj, dict):
            for k, v in list(obj.items()):
                obj[k] = squeezerec(k, v)
            return obj
        elif isinstance(obj, np.ndarray):
            if obj.dtype.names is None:
                if not obj.shape:
                    return squeezerec(None, obj.item())
                if obj.shape == (0,) or obj.shape == (0, 0):
                    return None
                else:
                    if obj.dtype == object:
                        lst = []
                        for idx, v in enumerate(obj):
                            lst.append(squeezerec(idx, v))
>                       return np.array(lst)
E                       ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

/wield/wield-utilities/src/wield/utilities/file_io/matlab_io.py:29: ValueError