Browse Source

Added tests for a few untested lines

Clara Hobbs 7 years ago
parent
commit
c9c58a5b4d
1 changed files with 36 additions and 12 deletions
  1. 36
    12
      test_pdbuddy/__init__.py

+ 36
- 12
test_pdbuddy/__init__.py View File

20
                 flags=pdbuddy.SinkFlags.NONE, v=15000, i=3000)
20
                 flags=pdbuddy.SinkFlags.NONE, v=15000, i=3000)
21
         self.obj_valid_gb = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
21
         self.obj_valid_gb = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
22
                 flags=pdbuddy.SinkFlags.GIVEBACK, v=15000, i=3000)
22
                 flags=pdbuddy.SinkFlags.GIVEBACK, v=15000, i=3000)
23
-        self.obj_huge_vi = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
24
-                flags=pdbuddy.SinkFlags.NONE, v=65536, i=65536)
25
-        self.obj_big_vi = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
26
-                flags=pdbuddy.SinkFlags.NONE, v=20001, i=5001)
27
-        self.obj_neg_vi = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
28
-                flags=pdbuddy.SinkFlags.NONE, v=-1, i=-1)
23
+
24
+        self.obj_huge_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
25
+                flags=pdbuddy.SinkFlags.NONE, v=65536, i=1000)
26
+        self.obj_big_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
27
+                flags=pdbuddy.SinkFlags.NONE, v=20001, i=1000)
28
+        self.obj_neg_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
29
+                flags=pdbuddy.SinkFlags.NONE, v=-1, i=1000)
30
+
31
+        self.obj_huge_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
32
+                flags=pdbuddy.SinkFlags.NONE, v=5000, i=65536)
33
+        self.obj_big_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
34
+                flags=pdbuddy.SinkFlags.NONE, v=5000, i=5001)
35
+        self.obj_neg_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
36
+                flags=pdbuddy.SinkFlags.NONE, v=5000, i=-1)
29
 
37
 
30
     def tearDown(self):
38
     def tearDown(self):
31
         # Close the connection to the PD Buddy Sink
39
         # Close the connection to the PD Buddy Sink
52
         self.pdbs.set_tmpcfg(self.obj_valid_gb)
60
         self.pdbs.set_tmpcfg(self.obj_valid_gb)
53
         self.assertEqual(self.pdbs.get_tmpcfg(), self.obj_valid_gb)
61
         self.assertEqual(self.pdbs.get_tmpcfg(), self.obj_valid_gb)
54
 
62
 
55
-    def test_set_tmpcfg_huge_vi(self):
63
+    def test_set_tmpcfg_huge_v(self):
64
+        with self.assertRaises(ValueError):
65
+            self.pdbs.set_tmpcfg(self.obj_huge_v)
66
+
67
+    def test_set_tmpcfg_big_v(self):
68
+        with self.assertRaises(ValueError):
69
+            self.pdbs.set_tmpcfg(self.obj_big_v)
70
+
71
+    def test_set_tmpcfg_neg_v(self):
72
+        with self.assertRaises(ValueError):
73
+            self.pdbs.set_tmpcfg(self.obj_neg_v)
74
+
75
+    def test_set_tmpcfg_huge_i(self):
56
         with self.assertRaises(ValueError):
76
         with self.assertRaises(ValueError):
57
-            self.pdbs.set_tmpcfg(self.obj_huge_vi)
77
+            self.pdbs.set_tmpcfg(self.obj_huge_i)
58
 
78
 
59
-    def test_set_tmpcfg_big_vi(self):
79
+    def test_set_tmpcfg_big_i(self):
60
         with self.assertRaises(ValueError):
80
         with self.assertRaises(ValueError):
61
-            self.pdbs.set_tmpcfg(self.obj_big_vi)
81
+            self.pdbs.set_tmpcfg(self.obj_big_i)
62
 
82
 
63
-    def test_set_tmpcfg_neg_vi(self):
83
+    def test_set_tmpcfg_neg_i(self):
64
         with self.assertRaises(ValueError):
84
         with self.assertRaises(ValueError):
65
-            self.pdbs.set_tmpcfg(self.obj_neg_vi)
85
+            self.pdbs.set_tmpcfg(self.obj_neg_i)
66
 
86
 
67
     def test_write(self):
87
     def test_write(self):
68
         self.test_set_tmpcfg_valid()
88
         self.test_set_tmpcfg_valid()
113
         except ValueError:
133
         except ValueError:
114
             self.skipTest("Unknown value returned by PD Buddy Sink")
134
             self.skipTest("Unknown value returned by PD Buddy Sink")
115
 
135
 
136
+    def test_send_command_invalid(self):
137
+        with self.assertRaises(KeyError):
138
+            self.pdbs.send_command("foo bar")
139
+
116
 
140
 
117
 class SinkConfigTestCase(unittest.TestCase):
141
 class SinkConfigTestCase(unittest.TestCase):
118
 
142
 

Loading…
Cancel
Save