From 003b517befd3353417ddae6df28d814520395c32 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 14:38:22 +0000 Subject: [PATCH 1/2] Refactor tests into package structure mirroring source code - Moved tests to `tests/nditests/unittest/...` - Renamed test files to match module names. - Updated README.md with correct test execution command. - Renamed `tests/ndi` to `tests/nditests` to prevent namespace shadowing. --- README.md | 2 +- tests/{test_fun => }/__init__.py | 0 tests/nditests/__init__.py | 0 tests/nditests/unittest/__init__.py | 0 tests/nditests/unittest/cloud/__init__.py | 0 tests/nditests/unittest/cloud/api/__init__.py | 0 tests/nditests/unittest/cloud/api/documents/__init__.py | 0 .../unittest/cloud/api/test_api.py} | 0 .../unittest/cloud/api/test_documents.py} | 0 tests/nditests/unittest/cloud/sync/__init__.py | 0 .../unittest/cloud/sync/test_download_new.py} | 0 .../unittest/cloud/test_create_dataset.py} | 0 tests/nditests/unittest/daq/__init__.py | 0 tests/nditests/unittest/daq/system/__init__.py | 0 .../unittest/daq/system/test_mfdaq.py} | 0 tests/{ => nditests/unittest/daq}/test_daqsystemstring.py | 0 tests/nditests/unittest/database/__init__.py | 0 tests/{ => nditests/unittest/database}/test_database.py | 0 tests/nditests/unittest/dataset/__init__.py | 0 tests/{ => nditests/unittest/dataset}/test_dataset.py | 0 tests/nditests/unittest/element/__init__.py | 0 tests/{ => nditests/unittest/element}/test_element.py | 0 tests/nditests/unittest/epoch/__init__.py | 0 tests/{ => nditests/unittest/epoch}/test_epochset.py | 0 tests/nditests/unittest/file/__init__.py | 0 .../unittest/file/test_navigator.py} | 0 tests/nditests/unittest/fun/__init__.py | 0 tests/{test_fun => nditests/unittest/fun}/test_doc.py | 0 tests/{test_fun => nditests/unittest/fun}/test_epoch.py | 0 tests/{test_fun => nditests/unittest/fun}/test_fun_basics.py | 0 tests/{test_fun => nditests/unittest/fun}/test_stimulus.py | 0 tests/{test_fun => nditests/unittest/fun}/test_table.py | 0 tests/nditests/unittest/probe/__init__.py | 0 tests/nditests/unittest/probe/fun/__init__.py | 0 .../unittest/probe/fun/test_fun.py} | 0 tests/{ => nditests/unittest/probe}/test_probe.py | 0 tests/nditests/unittest/session/__init__.py | 0 tests/{ => nditests/unittest/session}/test_session.py | 0 tests/{ => nditests/unittest}/test_cache.py | 0 tests/{ => nditests/unittest}/test_document.py | 0 tests/{ => nditests/unittest}/test_documentservice.py | 0 tests/{ => nditests/unittest}/test_ido.py | 0 tests/{ => nditests/unittest}/test_query.py | 0 tests/{ => nditests/unittest}/test_subject.py | 0 tests/nditests/unittest/time/__init__.py | 0 tests/{ => nditests/unittest/time}/test_time.py | 0 tests/{ => nditests/unittest/time}/test_timemapping.py | 0 47 files changed, 1 insertion(+), 1 deletion(-) rename tests/{test_fun => }/__init__.py (100%) create mode 100644 tests/nditests/__init__.py create mode 100644 tests/nditests/unittest/__init__.py create mode 100644 tests/nditests/unittest/cloud/__init__.py create mode 100644 tests/nditests/unittest/cloud/api/__init__.py create mode 100644 tests/nditests/unittest/cloud/api/documents/__init__.py rename tests/{test_cloud_api.py => nditests/unittest/cloud/api/test_api.py} (100%) rename tests/{test_cloud_documents.py => nditests/unittest/cloud/api/test_documents.py} (100%) create mode 100644 tests/nditests/unittest/cloud/sync/__init__.py rename tests/{test_cloud_sync_download_new.py => nditests/unittest/cloud/sync/test_download_new.py} (100%) rename tests/{test_cloud_create_dataset.py => nditests/unittest/cloud/test_create_dataset.py} (100%) create mode 100644 tests/nditests/unittest/daq/__init__.py create mode 100644 tests/nditests/unittest/daq/system/__init__.py rename tests/{test_daq_system.py => nditests/unittest/daq/system/test_mfdaq.py} (100%) rename tests/{ => nditests/unittest/daq}/test_daqsystemstring.py (100%) create mode 100644 tests/nditests/unittest/database/__init__.py rename tests/{ => nditests/unittest/database}/test_database.py (100%) create mode 100644 tests/nditests/unittest/dataset/__init__.py rename tests/{ => nditests/unittest/dataset}/test_dataset.py (100%) create mode 100644 tests/nditests/unittest/element/__init__.py rename tests/{ => nditests/unittest/element}/test_element.py (100%) create mode 100644 tests/nditests/unittest/epoch/__init__.py rename tests/{ => nditests/unittest/epoch}/test_epochset.py (100%) create mode 100644 tests/nditests/unittest/file/__init__.py rename tests/{test_file_navigator.py => nditests/unittest/file/test_navigator.py} (100%) create mode 100644 tests/nditests/unittest/fun/__init__.py rename tests/{test_fun => nditests/unittest/fun}/test_doc.py (100%) rename tests/{test_fun => nditests/unittest/fun}/test_epoch.py (100%) rename tests/{test_fun => nditests/unittest/fun}/test_fun_basics.py (100%) rename tests/{test_fun => nditests/unittest/fun}/test_stimulus.py (100%) rename tests/{test_fun => nditests/unittest/fun}/test_table.py (100%) create mode 100644 tests/nditests/unittest/probe/__init__.py create mode 100644 tests/nditests/unittest/probe/fun/__init__.py rename tests/{test_probe_fun.py => nditests/unittest/probe/fun/test_fun.py} (100%) rename tests/{ => nditests/unittest/probe}/test_probe.py (100%) create mode 100644 tests/nditests/unittest/session/__init__.py rename tests/{ => nditests/unittest/session}/test_session.py (100%) rename tests/{ => nditests/unittest}/test_cache.py (100%) rename tests/{ => nditests/unittest}/test_document.py (100%) rename tests/{ => nditests/unittest}/test_documentservice.py (100%) rename tests/{ => nditests/unittest}/test_ido.py (100%) rename tests/{ => nditests/unittest}/test_query.py (100%) rename tests/{ => nditests/unittest}/test_subject.py (100%) create mode 100644 tests/nditests/unittest/time/__init__.py rename tests/{ => nditests/unittest/time}/test_time.py (100%) rename tests/{ => nditests/unittest/time}/test_timemapping.py (100%) diff --git a/README.md b/README.md index c7267f1..6285ce4 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ pip install -e . To run the tests, use the following command: ```bash -python -m unittest discover tests +python -m unittest discover -s tests -t . ``` ### Building Documentation diff --git a/tests/test_fun/__init__.py b/tests/__init__.py similarity index 100% rename from tests/test_fun/__init__.py rename to tests/__init__.py diff --git a/tests/nditests/__init__.py b/tests/nditests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/__init__.py b/tests/nditests/unittest/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/cloud/__init__.py b/tests/nditests/unittest/cloud/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/cloud/api/__init__.py b/tests/nditests/unittest/cloud/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/cloud/api/documents/__init__.py b/tests/nditests/unittest/cloud/api/documents/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_cloud_api.py b/tests/nditests/unittest/cloud/api/test_api.py similarity index 100% rename from tests/test_cloud_api.py rename to tests/nditests/unittest/cloud/api/test_api.py diff --git a/tests/test_cloud_documents.py b/tests/nditests/unittest/cloud/api/test_documents.py similarity index 100% rename from tests/test_cloud_documents.py rename to tests/nditests/unittest/cloud/api/test_documents.py diff --git a/tests/nditests/unittest/cloud/sync/__init__.py b/tests/nditests/unittest/cloud/sync/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_cloud_sync_download_new.py b/tests/nditests/unittest/cloud/sync/test_download_new.py similarity index 100% rename from tests/test_cloud_sync_download_new.py rename to tests/nditests/unittest/cloud/sync/test_download_new.py diff --git a/tests/test_cloud_create_dataset.py b/tests/nditests/unittest/cloud/test_create_dataset.py similarity index 100% rename from tests/test_cloud_create_dataset.py rename to tests/nditests/unittest/cloud/test_create_dataset.py diff --git a/tests/nditests/unittest/daq/__init__.py b/tests/nditests/unittest/daq/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/daq/system/__init__.py b/tests/nditests/unittest/daq/system/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_daq_system.py b/tests/nditests/unittest/daq/system/test_mfdaq.py similarity index 100% rename from tests/test_daq_system.py rename to tests/nditests/unittest/daq/system/test_mfdaq.py diff --git a/tests/test_daqsystemstring.py b/tests/nditests/unittest/daq/test_daqsystemstring.py similarity index 100% rename from tests/test_daqsystemstring.py rename to tests/nditests/unittest/daq/test_daqsystemstring.py diff --git a/tests/nditests/unittest/database/__init__.py b/tests/nditests/unittest/database/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_database.py b/tests/nditests/unittest/database/test_database.py similarity index 100% rename from tests/test_database.py rename to tests/nditests/unittest/database/test_database.py diff --git a/tests/nditests/unittest/dataset/__init__.py b/tests/nditests/unittest/dataset/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_dataset.py b/tests/nditests/unittest/dataset/test_dataset.py similarity index 100% rename from tests/test_dataset.py rename to tests/nditests/unittest/dataset/test_dataset.py diff --git a/tests/nditests/unittest/element/__init__.py b/tests/nditests/unittest/element/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_element.py b/tests/nditests/unittest/element/test_element.py similarity index 100% rename from tests/test_element.py rename to tests/nditests/unittest/element/test_element.py diff --git a/tests/nditests/unittest/epoch/__init__.py b/tests/nditests/unittest/epoch/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_epochset.py b/tests/nditests/unittest/epoch/test_epochset.py similarity index 100% rename from tests/test_epochset.py rename to tests/nditests/unittest/epoch/test_epochset.py diff --git a/tests/nditests/unittest/file/__init__.py b/tests/nditests/unittest/file/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_file_navigator.py b/tests/nditests/unittest/file/test_navigator.py similarity index 100% rename from tests/test_file_navigator.py rename to tests/nditests/unittest/file/test_navigator.py diff --git a/tests/nditests/unittest/fun/__init__.py b/tests/nditests/unittest/fun/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_fun/test_doc.py b/tests/nditests/unittest/fun/test_doc.py similarity index 100% rename from tests/test_fun/test_doc.py rename to tests/nditests/unittest/fun/test_doc.py diff --git a/tests/test_fun/test_epoch.py b/tests/nditests/unittest/fun/test_epoch.py similarity index 100% rename from tests/test_fun/test_epoch.py rename to tests/nditests/unittest/fun/test_epoch.py diff --git a/tests/test_fun/test_fun_basics.py b/tests/nditests/unittest/fun/test_fun_basics.py similarity index 100% rename from tests/test_fun/test_fun_basics.py rename to tests/nditests/unittest/fun/test_fun_basics.py diff --git a/tests/test_fun/test_stimulus.py b/tests/nditests/unittest/fun/test_stimulus.py similarity index 100% rename from tests/test_fun/test_stimulus.py rename to tests/nditests/unittest/fun/test_stimulus.py diff --git a/tests/test_fun/test_table.py b/tests/nditests/unittest/fun/test_table.py similarity index 100% rename from tests/test_fun/test_table.py rename to tests/nditests/unittest/fun/test_table.py diff --git a/tests/nditests/unittest/probe/__init__.py b/tests/nditests/unittest/probe/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/probe/fun/__init__.py b/tests/nditests/unittest/probe/fun/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_probe_fun.py b/tests/nditests/unittest/probe/fun/test_fun.py similarity index 100% rename from tests/test_probe_fun.py rename to tests/nditests/unittest/probe/fun/test_fun.py diff --git a/tests/test_probe.py b/tests/nditests/unittest/probe/test_probe.py similarity index 100% rename from tests/test_probe.py rename to tests/nditests/unittest/probe/test_probe.py diff --git a/tests/nditests/unittest/session/__init__.py b/tests/nditests/unittest/session/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_session.py b/tests/nditests/unittest/session/test_session.py similarity index 100% rename from tests/test_session.py rename to tests/nditests/unittest/session/test_session.py diff --git a/tests/test_cache.py b/tests/nditests/unittest/test_cache.py similarity index 100% rename from tests/test_cache.py rename to tests/nditests/unittest/test_cache.py diff --git a/tests/test_document.py b/tests/nditests/unittest/test_document.py similarity index 100% rename from tests/test_document.py rename to tests/nditests/unittest/test_document.py diff --git a/tests/test_documentservice.py b/tests/nditests/unittest/test_documentservice.py similarity index 100% rename from tests/test_documentservice.py rename to tests/nditests/unittest/test_documentservice.py diff --git a/tests/test_ido.py b/tests/nditests/unittest/test_ido.py similarity index 100% rename from tests/test_ido.py rename to tests/nditests/unittest/test_ido.py diff --git a/tests/test_query.py b/tests/nditests/unittest/test_query.py similarity index 100% rename from tests/test_query.py rename to tests/nditests/unittest/test_query.py diff --git a/tests/test_subject.py b/tests/nditests/unittest/test_subject.py similarity index 100% rename from tests/test_subject.py rename to tests/nditests/unittest/test_subject.py diff --git a/tests/nditests/unittest/time/__init__.py b/tests/nditests/unittest/time/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_time.py b/tests/nditests/unittest/time/test_time.py similarity index 100% rename from tests/test_time.py rename to tests/nditests/unittest/time/test_time.py diff --git a/tests/test_timemapping.py b/tests/nditests/unittest/time/test_timemapping.py similarity index 100% rename from tests/test_timemapping.py rename to tests/nditests/unittest/time/test_timemapping.py From c374c0b50a9052b374847b9eb5864692306d79c1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 15:15:24 +0000 Subject: [PATCH 2/2] Add ndimatlabport package for porting Matlab unit tests - Created `tests/nditests/unittest/ndimatlabport/` structure. - Added `README.md` with comparison table for tracking ported tests. - Implemented `test_dataset_build.py` mimicking `ndi.unittest.dataset.testDatasetBuild`. - Implemented `test_session_build.py` mimicking `ndi.unittest.session.testSessionBuild`. --- .../nditests/unittest/ndimatlabport/README.md | 16 +++++++++ .../unittest/ndimatlabport/__init__.py | 0 .../ndimatlabport/dataset/__init__.py | 0 .../dataset/test_dataset_build.py | 32 ++++++++++++++++++ .../ndimatlabport/session/__init__.py | 0 .../session/test_session_build.py | 33 +++++++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 tests/nditests/unittest/ndimatlabport/README.md create mode 100644 tests/nditests/unittest/ndimatlabport/__init__.py create mode 100644 tests/nditests/unittest/ndimatlabport/dataset/__init__.py create mode 100644 tests/nditests/unittest/ndimatlabport/dataset/test_dataset_build.py create mode 100644 tests/nditests/unittest/ndimatlabport/session/__init__.py create mode 100644 tests/nditests/unittest/ndimatlabport/session/test_session_build.py diff --git a/tests/nditests/unittest/ndimatlabport/README.md b/tests/nditests/unittest/ndimatlabport/README.md new file mode 100644 index 0000000..092426e --- /dev/null +++ b/tests/nditests/unittest/ndimatlabport/README.md @@ -0,0 +1,16 @@ +# ndimatlabport: Ported MATLAB Unit Tests + +This package contains Python ports of specific unit tests from the VH-Lab/NDI-matlab repository. The purpose is to run identical tests between the MATLAB and Python versions to identify points of divergence and ensure parity. + +## Structure + +The Python packages within this directory should mimic the MATLAB namespaces. For example, a test located at `+ndi/+unittest/+dataset/testDatasetBuild.m` in MATLAB should be ported to `tests/nditests/unittest/ndimatlabport/dataset/test_dataset_build.py`. + +## Comparison Table + +The following table tracks the status of MATLAB unit tests being ported to Python. + +| MatlabTests | Converted_Yet | +| :--- | :--- | +| `ndi.unittest.dataset.testDatasetBuild` | Yes | +| `ndi.unittest.session.testSessionBuild` | Yes | diff --git a/tests/nditests/unittest/ndimatlabport/__init__.py b/tests/nditests/unittest/ndimatlabport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/ndimatlabport/dataset/__init__.py b/tests/nditests/unittest/ndimatlabport/dataset/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/ndimatlabport/dataset/test_dataset_build.py b/tests/nditests/unittest/ndimatlabport/dataset/test_dataset_build.py new file mode 100644 index 0000000..8a66d9a --- /dev/null +++ b/tests/nditests/unittest/ndimatlabport/dataset/test_dataset_build.py @@ -0,0 +1,32 @@ +import unittest +from ndi.dataset import Dataset +from ndi.session.dir import Dir as SessionDir +import tempfile +import shutil + +class TestDatasetBuild(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.session_name = 'mysession' + self.session = SessionDir(self.session_name, self.temp_dir) + self.dataset_id = 'test_dataset_id' + self.dataset_name = 'test_dataset' + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_dataset_instantiation(self): + """ + Tests the basic instantiation of a Dataset object, mimicking ndi.unittest.dataset.testDatasetBuild. + """ + # The Python implementation of Dataset currently only takes a reference argument. + ds = Dataset(self.dataset_name) + + self.assertIsInstance(ds, Dataset) + # Verify the reference is set correctly via the session + self.assertEqual(ds.reference(), self.dataset_name) + # Verify it has an ID (which is generated by IDO in the Session) + self.assertIsNotNone(ds.id()) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/nditests/unittest/ndimatlabport/session/__init__.py b/tests/nditests/unittest/ndimatlabport/session/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/nditests/unittest/ndimatlabport/session/test_session_build.py b/tests/nditests/unittest/ndimatlabport/session/test_session_build.py new file mode 100644 index 0000000..83cdc80 --- /dev/null +++ b/tests/nditests/unittest/ndimatlabport/session/test_session_build.py @@ -0,0 +1,33 @@ +import unittest +from ndi.session.dir import Dir as SessionDir +import tempfile +import shutil +import os + +class TestSessionBuild(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.mkdtemp() + self.session_name = 'mysession' + + def tearDown(self): + shutil.rmtree(self.temp_dir) + + def test_session_instantiation(self): + """ + Tests the basic instantiation of a Session object, mimicking ndi.unittest.session.testSessionBuild. + """ + session_path = os.path.join(self.temp_dir, self.session_name) + os.makedirs(session_path) + + # Test creation with valid path + session = SessionDir(self.session_name, session_path) + self.assertIsInstance(session, SessionDir) + + # SessionDir stores the session path + self.assertEqual(session.path, session_path) + + # Session ID is generated by IDO, so we just check it exists + self.assertIsNotNone(session.id()) + +if __name__ == '__main__': + unittest.main()