From 0726256ce1bb2d81a8bd1413e133b77f52905cd6 Mon Sep 17 00:00:00 2001 From: bruAristimunha Date: Tue, 29 Jul 2025 23:14:18 +0200 Subject: [PATCH 1/3] fixing small problem with new version --- moabb/datasets/braininvaders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moabb/datasets/braininvaders.py b/moabb/datasets/braininvaders.py index 5eda4bd2e..7b79f962f 100644 --- a/moabb/datasets/braininvaders.py +++ b/moabb/datasets/braininvaders.py @@ -284,7 +284,7 @@ def _bi_data_path( # noqa: C901 zip_ref = z.ZipFile(path_zip, "r") zip_ref.extractall(path_folder) os.makedirs(osp.join(directory, f"Session{i + 1}")) - shutil.copy_tree(path_zip.strip(".zip"), directory) + shutil.copytree(path_zip.strip(".zip"), directory) shutil.rmtree(path_zip.strip(".zip")) # filter the data regarding the experimental conditions From c9a88e9e09dfaf497025e96a6711a10be37ac144 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:41:01 +0000 Subject: [PATCH 2/3] feat: Add test for Weibo2014 dataset This commit adds a new test for the `Weibo2014` dataset to improve the test coverage of the `moabb/datasets` module. The new test verifies that the `get_data` method of the `Weibo2014` dataset works as expected. It checks that the data is downloaded and loaded correctly into an MNE Raw object. The test is marked as a download test and will be skipped unless the `--dl-data` flag is provided to pytest. --- download_test.py | 21 +++++++++++++++++++++ moabb/tests/test_datasets.py | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 download_test.py diff --git a/download_test.py b/download_test.py new file mode 100644 index 000000000..418338284 --- /dev/null +++ b/download_test.py @@ -0,0 +1,21 @@ +import pooch +import os +from pooch import Unzip + +FILES = [] +FILES.append("https://dataverse.harvard.edu/api/access/datafile/2499178") + +base_path = os.path.join(os.path.expanduser("~"), "mne_data", "WEIBO", "MNE-weibo-2014") +if not os.path.isdir(base_path): + os.makedirs(base_path) + +print(f"Downloading to {base_path}") +pooch.retrieve( + FILES[0], + None, + "data0.zip", + base_path, + processor=Unzip(), + progressbar=True, +) +print("Download finished") diff --git a/moabb/tests/test_datasets.py b/moabb/tests/test_datasets.py index 4ad57a9af..d40dff334 100644 --- a/moabb/tests/test_datasets.py +++ b/moabb/tests/test_datasets.py @@ -566,6 +566,33 @@ def test_epochs(self, data, dataset): assert all([a == b for a, b in zip(raw.annotations.description[:3], description)]) +class TestWeibo2014: + @pytest.mark.parametrize("subject", [1]) + def test_get_data(self, subject, dl_data): + if not dl_data: + pytest.skip("Skipping download test") + ds = db.Weibo2014() + data = ds.get_data(subjects=[subject]) + + # we should get a dict + assert isinstance(data, dict) + + # we get the right number of subject + assert len(data) == 1 + assert subject in data + + # right number of session + assert len(data[subject]) == 1 + assert "0" in data[subject] + + # right number of run + assert len(data[subject]["0"]) == 1 + assert "0" in data[subject]["0"] + + # We should get a raw array at the end + assert isinstance(data[subject]["0"]["0"], mne.io.BaseRaw) + + class TestBIDSDataset: @pytest.fixture(scope="class") def cached_dataset_root(self, tmpdir_factory): From ac2af7113ef5da401f7ff074948fa8440f910713 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:32:11 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks --- download_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/download_test.py b/download_test.py index 418338284..fc76544e5 100644 --- a/download_test.py +++ b/download_test.py @@ -1,7 +1,9 @@ -import pooch import os + +import pooch from pooch import Unzip + FILES = [] FILES.append("https://dataverse.harvard.edu/api/access/datafile/2499178")