You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
899 B

  1. import unittest
  2. from os import path
  3. from nd2reader.artificial import ArtificialND2
  4. from nd2reader.common import check_or_make_dir
  5. from nd2reader.legacy import Nd2
  6. class TestLegacy(unittest.TestCase):
  7. def create_test_nd2(self):
  8. with ArtificialND2(self.test_file) as artificial:
  9. artificial.close()
  10. def setUp(self):
  11. dir_path = path.dirname(path.realpath(__file__))
  12. check_or_make_dir(path.join(dir_path, 'test_data/'))
  13. self.test_file = path.join(dir_path, 'test_data/test.nd2')
  14. def test_can_open_test_file(self):
  15. self.create_test_nd2()
  16. with Nd2(self.test_file) as reader:
  17. self.assertEqual(reader.width, 0)
  18. self.assertEqual(reader.height, 0)
  19. self.assertEqual(len(reader.z_levels), 1)
  20. self.assertEqual(len(reader.channels), 0)
  21. self.assertEqual(len(reader.frames), 0)