judithabk6 / med_bench

BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

Wrong test_m_is_binary #33

Closed sami6mz closed 1 year ago

sami6mz commented 1 year ago

In test_get_simulated_data.py :

The test about whether m is binary or not is wrong. It computes how much binary entries m has and compares it with n, while it should be compared with n*dim_m.

Lines 109-113 :

def test_m_is_binary(m, dict_param):
    if dict_param["type_m"] == "binary":
        assert sum(m.ravel() == 1) + sum(m.ravel() == 0) == dict_param["n"]
    else:
        assert sum(m.ravel() == 1) + sum(m.ravel() == 0) < dict_param["n"]

Correction :

def test_m_is_binary(m, dict_param):
    if dict_param["type_m"] == "binary":
        assert sum(m.ravel() == 1) + sum(m.ravel() == 0) == dict_param["n"]*dict_param["dim_m"]
    else:
        assert sum(m.ravel() == 1) + sum(m.ravel() == 0) < dict_param["n"]*dict_param["dim_m"]

Note : Since issue #4 is not resolved, this correction doesn't change anything. (m cannot be multidimensional)