def test___del__(self): """check StructureViewer.__del__() """ import gc from diffpy.pdfgui.control.fitstructure import FitStructure sv = StructureViewer() sv.executable = 'does/not/exist' fs = FitStructure('s1') fs.read(datafile('LaMnO3.stru')) self.assertRaises(ControlConfigError, sv.plot, fs) tmpd = sv._tmpdir self.failUnless(os.path.isdir(tmpd)) del sv gc.collect() self.failIf(os.path.isdir(tmpd)) return
def test___del__(self): """check StructureViewer.__del__() """ import gc from diffpy.pdfgui.control.fitstructure import FitStructure sv = StructureViewer() sv.executable = 'does/not/exist' fs = FitStructure('s1') fs.read(datafile('LaMnO3.stru')) self.assertRaises(ControlConfigError, sv.plot, fs) tmpd = sv._tmpdir self.assertTrue(os.path.isdir(tmpd)) del sv gc.collect() self.assertFalse(os.path.isdir(tmpd)) return
def test_plot(self): """check StructureViewer.plot() """ from diffpy.pdfgui.control.fitstructure import FitStructure sv = StructureViewer() # default executable is empty string self.assertEqual('', sv.executable) # and so plot raises ControlConfigError fs = FitStructure('s1') fs.read(datafile('LaMnO3.stru')) self.assertRaises(ControlConfigError, sv.plot, fs) sv.executable = 'does/not/exist' self.failUnless(None is sv._tmpdir) self.assertEqual(0, sv._plotcount) self.assertRaises(ControlConfigError, sv.plot, fs) self.failUnless(os.path.isdir(sv._tmpdir)) self.assertEqual(1, sv._plotcount) return
def test_plot(self): """check StructureViewer.plot() """ from diffpy.pdfgui.control.fitstructure import FitStructure sv = StructureViewer() # default executable is empty string self.assertEqual('', sv.executable) # and so plot raises ControlConfigError fs = FitStructure('s1') fs.read(datafile('LaMnO3.stru')) self.assertRaises(ControlConfigError, sv.plot, fs) sv.executable = 'does/not/exist' self.assertTrue(None is sv._tmpdir) self.assertEqual(0, sv._plotcount) self.assertRaises(ControlConfigError, sv.plot, fs) self.assertTrue(os.path.isdir(sv._tmpdir)) self.assertEqual(1, sv._plotcount) return