Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_core.py is failing #12

Open
nafkhamdc opened this issue Jun 9, 2023 · 0 comments
Open

test_core.py is failing #12

nafkhamdc opened this issue Jun 9, 2023 · 0 comments

Comments

@nafkhamdc
Copy link

nafkhamdc commented Jun 9, 2023

We packaged this tool for GNU Guix, the reproducible package manager, but encountered a failure in the TestMofaModelMethods.test_get_methods test case when running the tests for the mofax project. The test is failing with an error in the get_data() method of the mofax/core.py module.

The test fails with the following error message:

=================================== FAILURES ===================================
____________________ TestMofaModelMethods.test_get_methods _____________________

self = <tests.test_core.TestMofaModelMethods testMethod=test_get_methods>

    def test_get_methods(self):
        self.model.get_factors()
        self.model.get_factors(groups=0, scale=True, df=True)
        self.model.get_weights()
        self.model.get_weights(views=0, scale=True, df=True)
        self.model.get_data()
>       self.model.get_data(views=0, groups=0, df=True)

tests/test_core.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
mofax/core.py:719: in get_data
    y.columns = pd_features.feature.values
/gnu/store/ys41sbnqxf1c9pdas0g0aycy3p2pa2l1-python-pandas-1.4.4/lib/python3.10/site-packages/pandas/core/generic.py:5588: in __setattr__
    return object.__setattr__(self, name, value)
pandas/_libs/properties.pyx:70: in pandas._libs.properties.AxisProperty.__set__
    ???
/gnu/store/ys41sbnqxf1c9pdas0g0aycy3p2pa2l1-python-pandas-1.4.4/lib/python3.10/site-packages/pandas/core/generic.py:769: in _set_axis
    self._mgr.set_axis(axis, labels)
/gnu/store/ys41sbnqxf1c9pdas0g0aycy3p2pa2l1-python-pandas-1.4.4/lib/python3.10/site-packages/pandas/core/internals/managers.py:214: in set_axis
    self._validate_set_axis(axis, new_labels)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = BlockManager
Items: RangeIndex(start=0, stop=1, step=1)
Axis 1: RangeIndex(start=0, stop=22815240, step=1)
NumericBlock: slice(0, 1, 1), 1 x 22815240, dtype: float32
axis = 0
new_labels = Index(['KLHL17', 'HES4', 'ISG15', 'TNFRSF18', 'TNFRSF4', 'CPTP', 'AL645728.1',
       'MMP23B', 'SLC35E2A', 'PRKCZ',
 ...01062.1', 'ITGB2-AS1',
       'COL6A2', 'MCM3AP-AS1', 'C21orf58', 'DIP2A', 'S100B'],
      dtype='object', length=2076)

    @final
    def _validate_set_axis(self, axis: int, new_labels: Index) -> None:
        # Caller is responsible for ensuring we have an Index object.
        old_len = len(self.axes[axis])
        new_len = len(new_labels)
    
        if axis == 1 and len(self.items) == 0:
            # If we are setting the index on a DataFrame with no columns,
            #  it is OK to change the length.
            pass
    
        elif new_len != old_len:
>           raise ValueError(
                f"Length mismatch: Expected axis has {old_len} elements, new "
                f"values have {new_len} elements"
            )
E           ValueError: Length mismatch: Expected axis has 1 elements, new values have 2076 elements

/gnu/store/ys41sbnqxf1c9pdas0g0aycy3p2pa2l1-python-pandas-1.4.4/lib/python3.10/site-packages/pandas/core/internals/base.py:69: ValueError

Additional Info:
Test suite: pytest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant