forked from diffpy/diffpy.pdfgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_temperatureseriespanel.py
61 lines (48 loc) · 1.82 KB
/
test_temperatureseriespanel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
##############################################################################
#
# diffpy.pdfgui Complex Modeling Initiative
# (c) 2019 Brookhaven Science Associates,
# Brookhaven National Laboratory.
# All rights reserved.
#
# File coded by: Pavol Juhas
#
# See AUTHORS.txt for a list of people who contributed.
# See LICENSE.txt for license information.
#
##############################################################################
"""
Unit tests for the TemperatureSeriesPanel class.
"""
import unittest
import wx
from diffpy.pdfgui.gui.temperatureseriespanel import TemperatureSeriesPanel
from diffpy.pdfgui.tests.testutils import GUITestCase, datafile, overridefiledialog
# ----------------------------------------------------------------------------
class TestTemperatureSeriesPanel(GUITestCase):
def setUp(self):
self.app = wx.App()
self.frame = wx.Frame(None)
self.panel = TemperatureSeriesPanel(self.frame)
self.panel.mainFrame = self._mockUpMainFrame()
self.panel.mainFrame.workpath = datafile("")
return
def tearDown(self):
self.frame.Close()
self.app.Destroy()
return
def test_onAdd(self):
"Check TemperatureSeriesPanel.onAdd"
panel = self.panel
paths = ["T017K.gr", "137K.gr", "lcmo_00.gr", "lcmo_20.gr"]
paths = [datafile(p) for p in paths]
with overridefiledialog(wx.ID_OK, paths):
panel.onAdd(None)
self.assertEqual(paths[-1], panel.fullpath)
self.assertEqual([17, 137, 10, 10], [tf[0] for tf in panel.datasets])
return
# End of class TestTemperatureSeriesPanel
# ----------------------------------------------------------------------------
if __name__ == "__main__":
unittest.main()