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
815 B

6 years ago
  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.exceptions import InvalidVersionError
  6. from nd2reader.parser import Parser
  7. class TestParser(unittest.TestCase):
  8. def create_test_nd2(self):
  9. with ArtificialND2(self.test_file) as artificial:
  10. artificial.close()
  11. def setUp(self):
  12. dir_path = path.dirname(path.realpath(__file__))
  13. check_or_make_dir(path.join(dir_path, 'test_data/'))
  14. self.test_file = path.join(dir_path, 'test_data/test.nd2')
  15. self.create_test_nd2()
  16. def test_can_open_test_file(self):
  17. self.create_test_nd2()
  18. with open(self.test_file, 'rb') as fh:
  19. parser = Parser(fh)
  20. self.assertTrue(parser.supported)