def test_core_difficult(self): '''Testcase for core functionality (difficult).''' infile1 = self.get_full_inpath('grass_base.png') infile2 = self.get_full_inpath('grass_sub.png') reffile = self.get_full_inpath('hypersurface_ref_grass.dat') outfile = self.get_full_outpath('hypersurface_cur_grass.dat') cmdargs = [infile1, infile2, '-o', outfile] with common.OutputCatcher() as _: picslide.main(cmdargs) equal = common.hypersurface_file_equals(outfile, reffile) self.assertTrue(equal) infile1 = self.get_full_inpath('gravel_base.png') infile2 = self.get_full_inpath('gravel_sub.png') reffile = self.get_full_inpath('hypersurface_ref_gravel.dat') outfile = self.get_full_outpath('hypersurface_cur_gravel.dat') cmdargs = [infile1, infile2, '-o', outfile] with common.OutputCatcher() as _: picslide.main(cmdargs) equal = common.hypersurface_file_equals(outfile, reffile) self.assertTrue(equal)
def test_stdout(self): '''When output goes to stdout instead of file.''' infile = self.get_input('gaas.gen') reffile = self.get_input('gaas.234.gen') outfile = self.get_output('gaas.234.gen') cmdargs = [infile, '2', '3', '4'] with common.OutputCatcher() as output: repeatgen.main(cmdargs) outfile = output.get_as_stringio() self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_stdout(self): '''When output goes to stdout instead of file.''' infile = self.get_input('h2o.gen') reffile = self.get_input('h2o.isostrain.gen') outfile = self.get_output('h2o.isostrain.gen') cmdargs = [infile, '10'] with common.OutputCatcher() as output: straingen.main(cmdargs) outfile = output.get_as_stringio() self.assertTrue(common.gen_file_equals(outfile, reffile))
def test_fail_invalid_infile(self): '''Testcase for invocation with invalid infile(s).''' # get unique temporary filename as invalid input file tmpname = common.get_temporary_filename(self.workroot) infile1 = self.get_full_inpath('base.png') infile2 = os.path.join(self.workdir, tmpname) outfile = self.get_full_outpath('hypersurface_cur.dat') cmdargs = [infile1, infile2, '-o', outfile] with common.OutputCatcher() as _: with self.assertRaises(ScriptError): picslide.main(cmdargs)
def test_with_ccorr(self): '''Testcase for additional cross correlation calculation.''' infile1 = self.get_full_inpath('retina_base.png') infile2 = self.get_full_inpath('retina_sub.png') reffile1 = self.get_full_inpath('hypersurface_ref_retina.dat') reffile2 = self.get_full_inpath('hypersurface_cc_ref_retina.dat') outfile1 = self.get_full_outpath('hypersurface_cur_retina.dat') outfile2 = self.get_full_outpath('hypersurface_cc_cur_retina.dat') cmdargs = [ infile1, infile2, '-c', '-o', outfile1, '--ccoutfile', outfile2 ] with common.OutputCatcher() as _: picslide.main(cmdargs) equal1 = common.hypersurface_file_equals(outfile1, reffile1) equal2 = common.hypersurface_file_equals(outfile2, reffile2) self.assertTrue(equal1 and equal2)