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

Python3.12: Test fails with ValueError #1012

Open
penguinpee opened this issue Jul 26, 2023 · 2 comments
Open

Python3.12: Test fails with ValueError #1012

penguinpee opened this issue Jul 26, 2023 · 2 comments

Comments

@penguinpee
Copy link

Python 3.12 has landed in Fedora. One of the tests fails with ValueError:

=================================== FAILURES ===================================
_________ test_run_variable_collection_bad_length_to_df_all_dense_vars _________
run_coll_bad_length = <BIDSRunVariableCollection['PTval', 'RT', 'gain', 'loss', 'parametric gain', 'respcat', 'respnum', 'trial_type']>
    def test_run_variable_collection_bad_length_to_df_all_dense_vars(run_coll_bad_length):
    
        timing_cols = {'onset', 'duration'}
        entity_cols = {'subject', 'run', 'task',  'suffix', 'datatype'}
        cond_names = {'PTval', 'RT', 'gain', 'loss', 'parametric gain', 'respcat',
                      'respnum', 'trial_type'}
        md_names = {'TaskName', 'RepetitionTime', 'extension', 'SliceTiming'}
        condition = {'condition'}
        ampl = {'amplitude'}
    
        unif_coll = run_coll_bad_length.to_dense(sampling_rate=10)
    
>       df = unif_coll.to_df()
bids/variables/tests/test_collections.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
bids/variables/collections.py:625: in to_df
    return super().to_df(
bids/variables/collections.py:152: in to_df
    dfs = [v.to_df(True, True, timing=True) for v in variables]
bids/variables/variables.py:618: in to_df
    df['onset'] = self.timestamps.values.astype(float) / 1e+9
/usr/lib64/python3.12/site-packages/pandas/core/frame.py:3980: in __setitem__
    self._set_item(key, value)
/usr/lib64/python3.12/site-packages/pandas/core/frame.py:4174: in _set_item
    value = self._sanitize_column(value)
/usr/lib64/python3.12/site-packages/pandas/core/frame.py:4915: in _sanitize_column
    com.require_length_match(value, self.index)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
data = array([0.0000e+00, 1.0000e-01, 2.0000e-01, ..., 4.3206e+03, 4.3207e+03,
       4.3208e+03])
index = RangeIndex(start=0, stop=43210, step=1)
    def require_length_match(data, index: Index) -> None:
        """
        Check the length of data matches the length of the index.
        """
        if len(data) != len(index):
>           raise ValueError(
                "Length of values "
                f"({len(data)}) "
                "does not match length of index "
                f"({len(index)})"
            )
E           ValueError: Length of values (43209) does not match length of index (43210)
/usr/lib64/python3.12/site-packages/pandas/core/common.py:571: ValueError
@effigies
Copy link
Collaborator

What versions of numpy and pandas? Are their test suites passing?

@penguinpee
Copy link
Author

numpy 1.24.4
pandas 1.5.3

Regarding test suits, looking at the builds of the packages, both run tests. Tests not succeeding breaks the build, requiring intervention by either fixing the tests or disabling them temporarily.

For numpy refcount related tests were disabled for Python3.12.

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

2 participants