-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_suite.py
71 lines (60 loc) · 2.22 KB
/
test_suite.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
62
63
64
65
66
67
68
69
70
71
# -----------------------------------------------------------------------------
# DUVET Test Suite
#
# This file executes various tests on DUVET and should always be run before
# comitting any changes.
# -----------------------------------------------------------------------------
import unittest
import duvet
import spectools
import deptools
import specGUI
import depGUI
class SpectrumDisplayTabTestCase(unittest.TestCase):
"""
A collection of tests associated with a SpectrumDisplayTab object.
"""
def setUp(self):
self.SDT = specGUI.spectrumDisplayTab(debug=False)
def test_add_remove_spectrum(self):
"""
Test the ability to add and remove a spectrum from the spectrum list
"""
# create the item in the speclist
self.SDT.add_spectrum()
# check
self.assertEqual(len(self.SDT.all_spectra), 1)
# remove the item from the speclist
item = self.SDT.speclist.item(0)
self.SDT.remove_spectra([item])
# check
self.assertEqual(len(self.SDT.all_spectra), 0)
self.assertEqual(self.SDT.speclist.item(0), None)
class guiSpectrumTestCase(unittest.TestCase):
"""
A collection of tests associated with a guiSpectrum object.
"""
def setUp(self):
self.SDT = specGUI.spectrumDisplayTab(debug=False)
self.guiSpec = specGUI.guiSpectrum(index=0, parentWindow=self.SDT,
debug=False)
self.guiSpec.make_list_item()
def test_color_change(self):
"""
Test the ability to change a spectrum's color
"""
# check the color cycle
self.assertEqual(self.guiSpec.cycle_color(), None)
# check the color picker
self.guiSpec.update_color()
def test_update_description(self):
"""
Test the ability of a spectrum to change description
"""
# make sure the default description is none
self.assertEqual(self.guiSpec.spec.description, "")
# apply a test description and make sure it was set
self.guiSpec.spec.update_description("test description")
self.assertEqual(self.guiSpec.spec.description, "test description")
if __name__ == '__main__':
unittest.main()