예제 #1
0
    def setUp(self):
        TestCase.setUp(self)

        self.tmpdir = tempfile.mkdtemp()

        self.ops = Options("test1")

        self.e = XMLExporter(DummyConverter)
예제 #2
0
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)
예제 #3
0
 def __init__(self):
     _Exporter.__init__(self, Converter)
예제 #4
0
 def __init__(self):
     _Exporter.__init__(self, Converter)