def test_getConfig(self):
     """check StructureViewer.getConfig()
     """
     sv = StructureViewer()
     self.assertEqual('%s', sv.getConfig()['argstr'])
     sv.argstr = 'foooo'
     self.assertEqual('foooo', sv.getConfig()['argstr'])
     return
예제 #2
0
 def test_getConfig(self):
     """check StructureViewer.getConfig()
     """
     sv = StructureViewer()
     self.assertEqual('%s', sv.getConfig()['argstr'])
     sv.argstr = 'foooo'
     self.assertEqual('foooo', sv.getConfig()['argstr'])
     return
예제 #3
0
 def test_setConfig(self):
     """check StructureViewer.setConfig()
     """
     sv = StructureViewer()
     cfg0 = sv.getConfig()
     sv.setConfig({'asdf': 7})
     self.assertEqual(cfg0, sv.getConfig())
     sv.setConfig({'executable': None})
     self.assertNotEqual(cfg0, sv.getConfig())
     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.failUnless(os.path.isdir(tmpd))
     del sv
     gc.collect()
     self.failIf(os.path.isdir(tmpd))
     return
예제 #5
0
 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_setConfig(self):
     """check StructureViewer.setConfig()
     """
     sv = StructureViewer()
     cfg0 = sv.getConfig()
     sv.setConfig({'asdf' : 7})
     self.assertEqual(cfg0, sv.getConfig())
     sv.setConfig({'executable' : None})
     self.assertNotEqual(cfg0, sv.getConfig())
     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
예제 #8
0
 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
예제 #9
0
 def test___init__(self):
     """check StructureViewer.__init__()
     """
     sv = StructureViewer()
     self.assertEqual('%s', sv.argstr)
     return