def setUp(self): unittest.TestCase.setUp(self) self.tmpdir = tempfile.mkdtemp() self.exp = ExporterTIFF(compress=9) self.datafile = _create_datafile()
class TestExporterTIFF(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.tmpdir = tempfile.mkdtemp() self.exp = ExporterTIFF(compress=9) self.datafile = _create_datafile() def tearDown(self): unittest.TestCase.tearDown(self) shutil.rmtree(self.tmpdir, ignore_errors=True) def testexport(self): self.exp.export(self.datafile, self.tmpdir) filepaths = self.exp.get() self.assertEqual(len(filepaths), len(_SUPPORTED_DTYPES)) for filepath in filepaths: with tifffile.TiffFile(filepath) as tif: actual = tif.asarray() identifier = os.path.splitext(os.path.basename(filepath))[0].split('_')[1] expected = self.datafile.data[identifier] np.testing.assert_almost_equal(actual, expected.T, 4)
class TestExporterTIFF(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.tmpdir = tempfile.mkdtemp() self.exp = ExporterTIFF(compress=9) self.datafile = _create_datafile() def tearDown(self): unittest.TestCase.tearDown(self) shutil.rmtree(self.tmpdir, ignore_errors=True) def testexport(self): self.exp.export(self.datafile, self.tmpdir) filepaths = self.exp.get() self.assertEqual(len(filepaths), len(_SUPPORTED_DTYPES)) for filepath in filepaths: with tifffile.TiffFile(filepath) as tif: actual = tif.asarray() identifier = os.path.splitext( os.path.basename(filepath))[0].split('_')[1] expected = self.datafile.data[identifier] np.testing.assert_almost_equal(actual, expected.T, 4)