From 529d1a209db97f309671726c8f2a545b9a9ceb76 Mon Sep 17 00:00:00 2001 From: Colin McNabb Date: Fri, 16 Oct 2026 15:00:11 +0200 Subject: [PATCH 1/2] BaseRawIO: the has_buffer_description_api() check tested the method object, not the result. A reader with a false flag went directly to the private method. For a reader with a method that shouldn't be used (like the Blackrock on PTP files) it returned a wrong description with no errors. An ExampleRawIO reader, whos flag is False, must raise ValueError. --- neo/rawio/baserawio.py | 2 +- neo/test/rawiotest/test_examplerawio.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/neo/rawio/baserawio.py b/neo/rawio/baserawio.py index 4207f3c03..b694197ec 100644 --- a/neo/rawio/baserawio.py +++ b/neo/rawio/baserawio.py @@ -1544,7 +1544,7 @@ def _rescale_epoch_duration(self, raw_duration: np.ndarray, dtype: np.dtype): # buffer api zone # must be implemented if has_buffer_description_api=True def get_analogsignal_buffer_description(self, block_index: int = 0, seg_index: int = 0, buffer_id: str = None): - if not self.has_buffer_description_api: + if not self.has_buffer_description_api(): raise ValueError("This reader do not support buffer_description API") descr = self._get_analogsignal_buffer_description(block_index, seg_index, buffer_id) return descr diff --git a/neo/test/rawiotest/test_examplerawio.py b/neo/test/rawiotest/test_examplerawio.py index ce932e0ff..a92b95712 100644 --- a/neo/test/rawiotest/test_examplerawio.py +++ b/neo/test/rawiotest/test_examplerawio.py @@ -42,6 +42,13 @@ class TestExampleRawIO( # name here instead of the filename. entities_to_test = ["fake1"] + def test_buffer_description_api_check(self): + """An ExampleRawIO reader, whose flag is False, must raise ValueError.""" + reader = ExampleRawIO(filename=self.get_local_path("fake1")) + reader.parse_header() + with self.assertRaises(ValueError): + reader.get_analogsignal_buffer_description(block_index=0, seg_index=0, buffer_id="0") + if __name__ == "__main__": unittest.main() From eab167f157ac0f0a741ea8b7713743c1a518841e Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Wed, 28 Oct 2026 02:19:40 -0400 Subject: [PATCH 2/2] Remove the has_buffer_description_api test --- neo/test/rawiotest/test_examplerawio.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/neo/test/rawiotest/test_examplerawio.py b/neo/test/rawiotest/test_examplerawio.py index a92b95712..ce932e0ff 100644 --- a/neo/test/rawiotest/test_examplerawio.py +++ b/neo/test/rawiotest/test_examplerawio.py @@ -42,13 +42,6 @@ class TestExampleRawIO( # name here instead of the filename. entities_to_test = ["fake1"] - def test_buffer_description_api_check(self): - """An ExampleRawIO reader, whose flag is False, must raise ValueError.""" - reader = ExampleRawIO(filename=self.get_local_path("fake1")) - reader.parse_header() - with self.assertRaises(ValueError): - reader.get_analogsignal_buffer_description(block_index=0, seg_index=0, buffer_id="0") - if __name__ == "__main__": unittest.main()