Skip to content

Commit a4968ce

Browse files
committed
fch5: Add tests
1 parent ab11ca4 commit a4968ce

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/imageseries/test_formats.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def setUp(self):
8585
self.fcfile = os.path.join(self.tmpdir, 'frame-cache.npz')
8686
self.fmt = 'frame-cache'
8787
self.thresh = 0.5
88+
self.style = 'npz'
8889
self.cache_file='frame-cache.npz'
8990
_, self.is_a = make_array_ims()
9091

@@ -93,9 +94,9 @@ def tearDown(self):
9394

9495
def test_fmtfc(self):
9596
"""save/load frame-cache format"""
96-
imageseries.write(self.is_a, self.fcfile, self.fmt,
97+
imageseries.write(self.is_a, self.fcfile, self.fmt, style=self.style,
9798
threshold=self.thresh, cache_file=self.cache_file)
98-
is_fc = imageseries.open(self.fcfile, self.fmt)
99+
is_fc = imageseries.open(self.fcfile, self.fmt, style=self.style)
99100
diff = compare(self.is_a, is_fc)
100101
self.assertAlmostEqual(diff, 0., "frame-cache reconstruction failed")
101102
self.assertTrue(compare_meta(self.is_a, is_fc))
@@ -104,9 +105,9 @@ def test_fmtfc_nocache_file(self):
104105
"""save/load frame-cache format with no cache_file arg"""
105106
imageseries.write(
106107
self.is_a, self.fcfile, self.fmt,
107-
threshold=self.thresh
108+
threshold=self.thresh, style=self.style
108109
)
109-
is_fc = imageseries.open(self.fcfile, self.fmt)
110+
is_fc = imageseries.open(self.fcfile, self.fmt, style=self.style)
110111
diff = compare(self.is_a, is_fc)
111112
self.assertAlmostEqual(diff, 0., "frame-cache reconstruction failed")
112113
self.assertTrue(compare_meta(self.is_a, is_fc))
@@ -117,11 +118,22 @@ def test_fmtfc_nparray(self):
117118
npa = np.array([0,2.0,1.3])
118119
self.is_a.metadata[key] = npa
119120

120-
imageseries.write(self.is_a, self.fcfile, self.fmt,
121+
imageseries.write(self.is_a, self.fcfile, self.fmt, style=self.style,
121122
threshold=self.thresh, cache_file=self.cache_file
122123
)
123-
is_fc = imageseries.open(self.fcfile, self.fmt)
124+
is_fc = imageseries.open(self.fcfile, self.fmt, style=self.style)
124125
meta = is_fc.metadata
125126
diff = np.linalg.norm(meta[key] - npa)
126127
self.assertAlmostEqual(diff, 0.,
127128
"frame-cache numpy array metadata failed")
129+
130+
131+
class TestFormatFrameCache_FCH5(TestFormatFrameCache):
132+
133+
def setUp(self):
134+
self.fcfile = os.path.join(self.tmpdir, 'frame-cache.fch5')
135+
self.fmt = 'frame-cache'
136+
self.style = 'fch5'
137+
self.thresh = 0.5
138+
self.cache_file = 'frame-cache.fch5'
139+
_, self.is_a = make_array_ims()

0 commit comments

Comments
 (0)