|
@@ -18,37 +18,37 @@ class SinkTestCase(unittest.TestCase):
|
18
|
18
|
|
19
|
19
|
self.obj_valid = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
20
|
20
|
flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
21
|
|
- i=3000)
|
|
21
|
+ i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
22
|
22
|
self.obj_valid_gb = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
23
|
23
|
flags=pdbuddy.SinkFlags.GIVEBACK, v=15000, vmin=None,
|
24
|
|
- vmax=None, i=3000)
|
|
24
|
+ vmax=None, i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
25
|
25
|
self.obj_range = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
26
|
26
|
flags=pdbuddy.SinkFlags.HV_PREFERRED, v=13800, vmin=12000,
|
27
|
|
- vmax=16000, i=2000)
|
|
27
|
+ vmax=16000, i=2000, idim=pdbuddy.SinkDimension.CURRENT)
|
28
|
28
|
|
29
|
29
|
self.obj_huge_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
30
|
30
|
flags=pdbuddy.SinkFlags.NONE, v=65536, vmin=None, vmax=None,
|
31
|
|
- i=1000)
|
|
31
|
+ i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
32
|
32
|
self.obj_big_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
33
|
33
|
flags=pdbuddy.SinkFlags.NONE, v=21001, vmin=None, vmax=None,
|
34
|
|
- i=1000)
|
|
34
|
+ i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
35
|
35
|
self.obj_neg_v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
36
|
36
|
flags=pdbuddy.SinkFlags.NONE, v=-1, vmin=None, vmax=None,
|
37
|
|
- i=1000)
|
|
37
|
+ i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
38
|
38
|
|
39
|
39
|
self.obj_inv_range = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
40
|
40
|
flags=pdbuddy.SinkFlags.HV_PREFERRED, v=13800, vmin=16000,
|
41
|
|
- vmax=12000, i=2000)
|
|
41
|
+ vmax=12000, i=2000, idim=pdbuddy.SinkDimension.CURRENT)
|
42
|
42
|
|
43
|
43
|
self.obj_huge_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
44
|
44
|
flags=pdbuddy.SinkFlags.NONE, v=5000, vmin=None, vmax=None,
|
45
|
|
- i=65536)
|
|
45
|
+ i=65536, idim=pdbuddy.SinkDimension.CURRENT)
|
46
|
46
|
self.obj_big_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
47
|
47
|
flags=pdbuddy.SinkFlags.NONE, v=5000, vmin=None, vmax=None,
|
48
|
|
- i=5001)
|
|
48
|
+ i=5001, idim=pdbuddy.SinkDimension.CURRENT)
|
49
|
49
|
self.obj_neg_i = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
50
|
50
|
flags=pdbuddy.SinkFlags.NONE, v=5000, vmin=None, vmax=None,
|
51
|
|
- i=-1)
|
|
51
|
+ i=-1, idim=pdbuddy.SinkDimension.CURRENT)
|
52
|
52
|
|
53
|
53
|
def tearDown(self):
|
54
|
54
|
# Close the connection to the PD Buddy Sink
|
|
@@ -168,30 +168,36 @@ class SinkConfigTestCase(unittest.TestCase):
|
168
|
168
|
|
169
|
169
|
def setUp(self):
|
170
|
170
|
self.obj_none = pdbuddy.SinkConfig(status=None, flags=None, v=None,
|
171
|
|
- vmin=None, vmax=None, i=None)
|
|
171
|
+ vmin=None, vmax=None, i=None, idim=None)
|
172
|
172
|
self.obj_empty = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.EMPTY,
|
173
|
|
- flags=None, v=None, vmin=None, vmax=None, i=None)
|
|
173
|
+ flags=None, v=None, vmin=None, vmax=None, i=None, idim=None)
|
174
|
174
|
self.obj_valid = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
175
|
175
|
flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
176
|
|
- i=3000)
|
|
176
|
+ i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
177
|
177
|
self.obj_invalid = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.INVALID,
|
178
|
178
|
flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
179
|
|
- i=3000)
|
|
179
|
+ i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
180
|
180
|
self.obj_valid_gb = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
181
|
181
|
flags=pdbuddy.SinkFlags.GIVEBACK, v=15000, vmin=None,
|
182
|
|
- vmax=None, i=3000)
|
|
182
|
+ vmax=None, i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
183
|
183
|
self.obj_valid_5v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
184
|
184
|
flags=pdbuddy.SinkFlags.NONE, v=5000, vmin=None, vmax=None,
|
185
|
|
- i=3000)
|
|
185
|
+ i=3000, idim=pdbuddy.SinkDimension.CURRENT)
|
186
|
186
|
self.obj_valid_1a = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
187
|
187
|
flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
188
|
|
- i=1000)
|
|
188
|
+ i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
189
|
189
|
self.obj_valid_range = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
190
|
190
|
flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=12000, vmax=16000,
|
191
|
|
- i=1000)
|
|
191
|
+ i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
192
|
192
|
self.obj_valid_hv = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
193
|
193
|
flags=pdbuddy.SinkFlags.HV_PREFERRED, v=15000, vmin=12000,
|
194
|
|
- vmax=16000, i=1000)
|
|
194
|
+ vmax=16000, i=1000, idim=pdbuddy.SinkDimension.CURRENT)
|
|
195
|
+ self.obj_valid_10w = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
196
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
197
|
+ i=10000, idim=pdbuddy.SinkDimension.POWER)
|
|
198
|
+ self.obj_valid_10r = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
|
199
|
+ flags=pdbuddy.SinkFlags.NONE, v=15000, vmin=None, vmax=None,
|
|
200
|
+ i=10000, idim=pdbuddy.SinkDimension.RESISTANCE)
|
195
|
201
|
|
196
|
202
|
def test_str_none(self):
|
197
|
203
|
self.assertEqual(str(self.obj_none), "No configuration")
|
|
@@ -229,6 +235,14 @@ class SinkConfigTestCase(unittest.TestCase):
|
229
|
235
|
"status: valid\nflags: HV_Preferred\nv: 15.000 V\n"
|
230
|
236
|
"vmin: 12.000 V\nvmax: 16.000 V\ni: 1.00 A")
|
231
|
237
|
|
|
238
|
+ def test_str_valid_10w(self):
|
|
239
|
+ self.assertEqual(str(self.obj_valid_10w),
|
|
240
|
+ "status: valid\nflags: (none)\nv: 15.000 V\np: 10.00 W")
|
|
241
|
+
|
|
242
|
+ def test_str_valid_10r(self):
|
|
243
|
+ self.assertEqual(str(self.obj_valid_10r),
|
|
244
|
+ "status: valid\nflags: (none)\nv: 15.000 V\nr: 10.00 \u03A9")
|
|
245
|
+
|
232
|
246
|
def test_from_text_none(self):
|
233
|
247
|
ft_none = pdbuddy.SinkConfig.from_text([])
|
234
|
248
|
self.assertEqual(ft_none, self.obj_none)
|
|
@@ -290,6 +304,20 @@ class SinkConfigTestCase(unittest.TestCase):
|
290
|
304
|
b"i: 1.00 A"])
|
291
|
305
|
self.assertEqual(ft_valid_hv, self.obj_valid_hv)
|
292
|
306
|
|
|
307
|
+ def test_from_text_valid_10w(self):
|
|
308
|
+ ft_valid_10w = pdbuddy.SinkConfig.from_text([b"status: valid",
|
|
309
|
+ b"flags: (none)",
|
|
310
|
+ b"v: 15.000 V",
|
|
311
|
+ b"p: 10.00 W"])
|
|
312
|
+ self.assertEqual(ft_valid_10w, self.obj_valid_10w)
|
|
313
|
+
|
|
314
|
+ def test_from_text_valid_10r(self):
|
|
315
|
+ ft_valid_10r = pdbuddy.SinkConfig.from_text([b"status: valid",
|
|
316
|
+ b"flags: (none)",
|
|
317
|
+ b"v: 15.000 V",
|
|
318
|
+ b"r: 10.00 \u03A9"])
|
|
319
|
+ self.assertEqual(ft_valid_10r, self.obj_valid_10r)
|
|
320
|
+
|
293
|
321
|
def test_from_text_invalid_index(self):
|
294
|
322
|
with self.assertRaises(IndexError):
|
295
|
323
|
pdbuddy.SinkConfig.from_text([b"Invalid index"])
|