Browse Source

Fixes issue #25, adds unit tests and release 3.2.1

feature/load_slices
Ruben Verweij 5 years ago
parent
commit
d98e7acb71
5 changed files with 30 additions and 5 deletions
  1. +1
    -1
      docs
  2. +1
    -1
      nd2reader/__init__.py
  3. +1
    -1
      setup.py
  4. +2
    -2
      sphinx/conf.py
  5. +25
    -0
      tests/test_reader.py

+ 1
- 1
docs

@ -1 +1 @@
Subproject commit e8e0d21ccc8121fc30e1296a05dadb8aa9e22efa
Subproject commit f700c239f8f9d7d1f99a3c10d9f67e2b3b8ef307

+ 1
- 1
nd2reader/__init__.py View File

@ -1,4 +1,4 @@
from nd2reader.reader import ND2Reader from nd2reader.reader import ND2Reader
from nd2reader.legacy import Nd2 from nd2reader.legacy import Nd2
__version__ = '3.2.0'
__version__ = '3.2.1'

+ 1
- 1
setup.py View File

@ -1,6 +1,6 @@
from setuptools import setup from setuptools import setup
VERSION = '3.2.0'
VERSION = '3.2.1'
if __name__ == '__main__': if __name__ == '__main__':
setup( setup(


+ 2
- 2
sphinx/conf.py View File

@ -44,9 +44,9 @@ author = 'Ruben Verweij'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '3.2.0'
version = '3.2.1'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '3.2.0'
release = '3.2.1'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.


+ 25
- 0
tests/test_reader.py View File

@ -1,6 +1,8 @@
import unittest import unittest
import numpy as np import numpy as np
import struct
from pims import Frame
from nd2reader.artificial import ArtificialND2 from nd2reader.artificial import ArtificialND2
from nd2reader.exceptions import EmptyFileError from nd2reader.exceptions import EmptyFileError
from nd2reader.reader import ND2Reader from nd2reader.reader import ND2Reader
@ -41,3 +43,26 @@ class TestReader(unittest.TestCase):
with ND2Reader('test_data/test_nd2_reader.nd2') as reader: with ND2Reader('test_data/test_nd2_reader.nd2') as reader:
timesteps = reader.timesteps timesteps = reader.timesteps
self.assertEquals(len(timesteps), 0) self.assertEquals(len(timesteps), 0)
def test_get_frame_2D(self):
# Best test we can do for now:
# test everything up to the actual unpacking of the frame data
with ArtificialND2('test_data/test_nd2_reader.nd2') as _:
with ND2Reader('test_data/test_nd2_reader.nd2') as reader:
with self.assertRaises(struct.error) as exception:
frame = reader.get_frame_2D(c=0, t=0, z=0, x=0, y=0, v=0)
self.assertEqual(str(exception.exception), "unpack requires a buffer of 8 bytes")
def test_get_frame_vczyx(self):
# Best test we can do for now:
# test everything up to the actual unpacking of the frame data
with ArtificialND2('test_data/test_nd2_reader.nd2') as _:
with ND2Reader('test_data/test_nd2_reader.nd2') as reader:
with self.assertRaises(struct.error) as exception:
frame = reader.get_frame_vczyx(c=0, t=0, z=0, x=0, y=0, v=0)
self.assertEqual(str(exception.exception), "unpack requires a buffer of 8 bytes")

Loading…
Cancel
Save