Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

test_exampleio.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # -*- coding: utf-8 -*-
  2. """
  3. Tests of neo.io.exampleio
  4. """
  5. # needed for python 3 compatibility
  6. from __future__ import absolute_import, division
  7. import unittest
  8. from neo.io.exampleio import ExampleIO, HAVE_SCIPY
  9. from neo.test.iotest.common_io_test import BaseTestIO
  10. class TestExampleIO(BaseTestIO, unittest.TestCase, ):
  11. ioclass = ExampleIO
  12. files_to_test = ['fake1',
  13. 'fake2',
  14. ]
  15. files_to_download = []
  16. class TestExample2IO(unittest.TestCase):
  17. @unittest.skipUnless(HAVE_SCIPY, "requires scipy")
  18. def test_read_segment_lazy(self):
  19. r = ExampleIO(filename=None)
  20. seg = r.read_segment(cascade=True, lazy=True)
  21. for ana in seg.analogsignals:
  22. self.assertEqual(ana.size, 0)
  23. assert hasattr(ana, 'lazy_shape')
  24. for st in seg.spiketrains:
  25. self.assertEqual(st.size, 0)
  26. assert hasattr(st, 'lazy_shape')
  27. seg = r.read_segment(cascade=True, lazy=False)
  28. for ana in seg.analogsignals:
  29. self.assertNotEqual(ana.size, 0)
  30. for st in seg.spiketrains:
  31. self.assertNotEqual(st.size, 0)
  32. @unittest.skipUnless(HAVE_SCIPY, "requires scipy")
  33. def test_read_segment_cascade(self):
  34. r = ExampleIO(filename=None)
  35. seg = r.read_segment(cascade=False)
  36. self.assertEqual(len(seg.analogsignals), 0)
  37. seg = r.read_segment(cascade=True, num_analogsignal=4)
  38. self.assertEqual(len(seg.analogsignals), 4)
  39. @unittest.skipUnless(HAVE_SCIPY, "requires scipy")
  40. def test_read_analogsignal(self):
  41. r = ExampleIO(filename=None)
  42. r.read_analogsignal(lazy=False, segment_duration=15., t_start=-1)
  43. @unittest.skipUnless(HAVE_SCIPY, "requires scipy")
  44. def read_spiketrain(self):
  45. r = ExampleIO(filename=None)
  46. r.read_spiketrain(lazy=False,)
  47. if __name__ == "__main__":
  48. unittest.main()