Browse Source

#42 added simple calculate_channel test

zolfa-add_slices_loading
jim 10 years ago
parent
commit
8ae2bf6d06
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      tests/__init__.py

+ 7
- 1
tests/__init__.py View File

@ -88,6 +88,11 @@ class TestNd2Parser(unittest.TestCase):
for i in range(50, 60): for i in range(50, 60):
self.assertEqual(Nd2Parser._calculate_field_of_view(nd2, i), 2) self.assertEqual(Nd2Parser._calculate_field_of_view(nd2, i), 2)
def test_calculate_channel_simple(self):
nd2 = MockNd2Parser(['GFP'], [0], [0])
for i in range(1000):
self.assertEqual(Nd2Parser._calculate_channel(nd2, i), 'GFP')
def test_calculate_channel(self): def test_calculate_channel(self):
nd2 = MockNd2Parser(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], [0], [0]) nd2 = MockNd2Parser(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], [0], [0])
for i in range(1000): for i in range(1000):
@ -104,4 +109,5 @@ class TestNd2Parser(unittest.TestCase):
nd2 = MockNd2Parser(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], list(range(31)), list(range(17))) nd2 = MockNd2Parser(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], list(range(31)), list(range(17)))
for i in range(1000): for i in range(1000):
for n, channel in enumerate(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], start=i*7): for n, channel in enumerate(['', 'GFP', 'dsRed', 'dTomato', 'lulzBlue', 'jimbotronPurple', 'orange'], start=i*7):
self.assertEqual(Nd2Parser._calculate_channel(nd2, n), channel)
self.assertEqual(Nd2Parser._calculate_channel(nd2, n), channel)

Loading…
Cancel
Save