def setUp(self): TestCase.setUp(self) self.tmpdir = tempfile.mkdtemp() self.ops = Options("test1") self.e = XMLExporter(DummyConverter)
class TestXMLExporter(TestCase): def setUp(self): TestCase.setUp(self) self.tmpdir = tempfile.mkdtemp() self.ops = Options("test1") self.e = XMLExporter(DummyConverter) def tearDown(self): TestCase.tearDown(self) shutil.rmtree(self.tmpdir, ignore_errors=True) def testexport(self): filepath = self.e.export(self.ops, self.tmpdir) self.assertTrue(os.path.exists(filepath)) self.assertIn(os.path.basename(filepath), os.listdir(self.tmpdir)) def testexport_multivalue_options(self): self.ops.beam.energy_eV = [1e3, 2e3] self.assertRaises(ValueError, self.e.export, self.ops, self.tmpdir)
def __init__(self): _Exporter.__init__(self, Converter)