5 class PortTestCase(unittest
.TestCase
):
7 def _create_comp(comp_cls
, name
=None):
13 return graph
.add_component(comp_cls
, name
)
15 def test_src_add_output_port(self
):
16 class MyIter(bt2
._UserMessageIterator
):
20 class MySource(bt2
._UserSourceComponent
,
21 message_iterator_class
=MyIter
):
22 def __init__(comp_self
, params
):
23 port
= comp_self
._add
_output
_port
('out')
24 self
.assertEqual(port
.name
, 'out')
26 comp
= self
._create
_comp
(MySource
)
27 self
.assertEqual(len(comp
.output_ports
), 1)
29 def test_flt_add_output_port(self
):
30 class MyIter(bt2
._UserMessageIterator
):
34 class MyFilter(bt2
._UserFilterComponent
,
35 message_iterator_class
=MyIter
):
36 def __init__(comp_self
, params
):
37 port
= comp_self
._add
_output
_port
('out')
38 self
.assertEqual(port
.name
, 'out')
40 comp
= self
._create
_comp
(MyFilter
)
41 self
.assertEqual(len(comp
.output_ports
), 1)
43 def test_flt_add_input_port(self
):
44 class MyIter(bt2
._UserMessageIterator
):
48 class MyFilter(bt2
._UserFilterComponent
,
49 message_iterator_class
=MyIter
):
50 def __init__(comp_self
, params
):
51 port
= comp_self
._add
_input
_port
('in')
52 self
.assertEqual(port
.name
, 'in')
54 comp
= self
._create
_comp
(MyFilter
)
55 self
.assertEqual(len(comp
.input_ports
), 1)
57 def test_sink_add_input_port(self
):
58 class MySink(bt2
._UserSinkComponent
):
59 def __init__(comp_self
, params
):
60 port
= comp_self
._add
_input
_port
('in')
61 self
.assertEqual(port
.name
, 'in')
66 comp
= self
._create
_comp
(MySink
)
67 self
.assertEqual(len(comp
.input_ports
), 1)
69 def test_user_src_output_ports_getitem(self
):
70 class MyIter(bt2
._UserMessageIterator
):
74 class MySource(bt2
._UserSourceComponent
,
75 message_iterator_class
=MyIter
):
76 def __init__(comp_self
, params
):
77 port1
= comp_self
._add
_output
_port
('clear')
78 port2
= comp_self
._add
_output
_port
('print')
79 port3
= comp_self
._add
_output
_port
('insert')
80 self
.assertEqual(port3
.addr
, comp_self
._output
_ports
['insert'].addr
)
81 self
.assertEqual(port2
.addr
, comp_self
._output
_ports
['print'].addr
)
82 self
.assertEqual(port1
.addr
, comp_self
._output
_ports
['clear'].addr
)
84 self
._create
_comp
(MySource
)
86 def test_user_flt_output_ports_getitem(self
):
87 class MyIter(bt2
._UserMessageIterator
):
91 class MyFilter(bt2
._UserFilterComponent
,
92 message_iterator_class
=MyIter
):
93 def __init__(comp_self
, params
):
94 port1
= comp_self
._add
_output
_port
('clear')
95 port2
= comp_self
._add
_output
_port
('print')
96 port3
= comp_self
._add
_output
_port
('insert')
97 self
.assertEqual(port3
.addr
, comp_self
._output
_ports
['insert'].addr
)
98 self
.assertEqual(port2
.addr
, comp_self
._output
_ports
['print'].addr
)
99 self
.assertEqual(port1
.addr
, comp_self
._output
_ports
['clear'].addr
)
101 self
._create
_comp
(MyFilter
)
103 def test_user_flt_input_ports_getitem(self
):
104 class MyIter(bt2
._UserMessageIterator
):
108 class MyFilter(bt2
._UserFilterComponent
,
109 message_iterator_class
=MyIter
):
110 def __init__(comp_self
, params
):
111 port1
= comp_self
._add
_input
_port
('clear')
112 port2
= comp_self
._add
_input
_port
('print')
113 port3
= comp_self
._add
_input
_port
('insert')
114 self
.assertEqual(port3
.addr
, comp_self
._input
_ports
['insert'].addr
)
115 self
.assertEqual(port2
.addr
, comp_self
._input
_ports
['print'].addr
)
116 self
.assertEqual(port1
.addr
, comp_self
._input
_ports
['clear'].addr
)
118 self
._create
_comp
(MyFilter
)
120 def test_user_sink_input_ports_getitem(self
):
121 class MySink(bt2
._UserSinkComponent
):
122 def __init__(comp_self
, params
):
123 port1
= comp_self
._add
_input
_port
('clear')
124 port2
= comp_self
._add
_input
_port
('print')
125 port3
= comp_self
._add
_input
_port
('insert')
126 self
.assertEqual(port3
.addr
, comp_self
._input
_ports
['insert'].addr
)
127 self
.assertEqual(port2
.addr
, comp_self
._input
_ports
['print'].addr
)
128 self
.assertEqual(port1
.addr
, comp_self
._input
_ports
['clear'].addr
)
133 self
._create
_comp
(MySink
)
135 def test_user_src_output_ports_getitem_invalid_key(self
):
136 class MyIter(bt2
._UserMessageIterator
):
140 class MySource(bt2
._UserSourceComponent
,
141 message_iterator_class
=MyIter
):
142 def __init__(comp_self
, params
):
143 comp_self
._add
_output
_port
('clear')
144 comp_self
._add
_output
_port
('print')
145 comp_self
._add
_output
_port
('insert')
147 with self
.assertRaises(KeyError):
148 comp_self
._output
_ports
['hello']
150 self
._create
_comp
(MySource
)
152 def test_user_flt_output_ports_getitem_invalid_key(self
):
153 class MyIter(bt2
._UserMessageIterator
):
157 class MyFilter(bt2
._UserFilterComponent
,
158 message_iterator_class
=MyIter
):
159 def __init__(comp_self
, params
):
160 comp_self
._add
_output
_port
('clear')
161 comp_self
._add
_output
_port
('print')
162 comp_self
._add
_output
_port
('insert')
164 with self
.assertRaises(KeyError):
165 comp_self
._output
_ports
['hello']
167 self
._create
_comp
(MyFilter
)
169 def test_user_flt_input_ports_getitem_invalid_key(self
):
170 class MyIter(bt2
._UserMessageIterator
):
174 class MyFilter(bt2
._UserFilterComponent
,
175 message_iterator_class
=MyIter
):
176 def __init__(comp_self
, params
):
177 comp_self
._add
_input
_port
('clear')
178 comp_self
._add
_input
_port
('print')
179 comp_self
._add
_input
_port
('insert')
181 with self
.assertRaises(KeyError):
182 comp_self
._input
_ports
['hello']
184 self
._create
_comp
(MyFilter
)
186 def test_user_sink_input_ports_getitem_invalid_key(self
):
187 class MySink(bt2
._UserSinkComponent
):
188 def __init__(comp_self
, params
):
189 comp_self
._add
_input
_port
('clear')
190 comp_self
._add
_input
_port
('print')
191 comp_self
._add
_input
_port
('insert')
193 with self
.assertRaises(KeyError):
194 comp_self
._input
_ports
['hello']
199 self
._create
_comp
(MySink
)
201 def test_user_src_output_ports_len(self
):
202 class MyIter(bt2
._UserMessageIterator
):
206 class MySource(bt2
._UserSourceComponent
,
207 message_iterator_class
=MyIter
):
208 def __init__(comp_self
, params
):
209 comp_self
._add
_output
_port
('clear')
210 comp_self
._add
_output
_port
('print')
211 comp_self
._add
_output
_port
('insert')
212 self
.assertEqual(len(comp_self
._output
_ports
), 3)
214 self
._create
_comp
(MySource
)
216 def test_user_flt_output_ports_len(self
):
217 class MyIter(bt2
._UserMessageIterator
):
221 class MyFilter(bt2
._UserFilterComponent
,
222 message_iterator_class
=MyIter
):
223 def __init__(comp_self
, params
):
224 comp_self
._add
_output
_port
('clear')
225 comp_self
._add
_output
_port
('print')
226 comp_self
._add
_output
_port
('insert')
227 self
.assertEqual(len(comp_self
._output
_ports
), 3)
229 self
._create
_comp
(MyFilter
)
231 def test_user_flt_input_ports_len(self
):
232 class MyIter(bt2
._UserMessageIterator
):
236 class MyFilter(bt2
._UserFilterComponent
,
237 message_iterator_class
=MyIter
):
238 def __init__(comp_self
, params
):
239 comp_self
._add
_input
_port
('clear')
240 comp_self
._add
_input
_port
('print')
241 comp_self
._add
_input
_port
('insert')
242 self
.assertEqual(len(comp_self
._input
_ports
), 3)
244 self
._create
_comp
(MyFilter
)
246 def test_user_sink_input_ports_len(self
):
247 class MySink(bt2
._UserSinkComponent
):
248 def __init__(comp_self
, params
):
249 comp_self
._add
_input
_port
('clear')
250 comp_self
._add
_input
_port
('print')
251 comp_self
._add
_input
_port
('insert')
252 self
.assertEqual(len(comp_self
._input
_ports
), 3)
257 self
._create
_comp
(MySink
)
259 def test_user_src_output_ports_iter(self
):
260 class MyIter(bt2
._UserMessageIterator
):
264 class MySource(bt2
._UserSourceComponent
,
265 message_iterator_class
=MyIter
):
266 def __init__(comp_self
, params
):
267 port1
= comp_self
._add
_output
_port
('clear')
268 port2
= comp_self
._add
_output
_port
('print')
269 port3
= comp_self
._add
_output
_port
('insert')
272 for port_name
, port
in comp_self
._output
_ports
.items():
273 ports
.append((port_name
, port
))
275 self
.assertEqual(ports
[0][0], 'clear')
276 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
277 self
.assertEqual(ports
[1][0], 'print')
278 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
279 self
.assertEqual(ports
[2][0], 'insert')
280 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
282 self
._create
_comp
(MySource
)
284 def test_user_flt_output_ports_iter(self
):
285 class MyIter(bt2
._UserMessageIterator
):
289 class MyFilter(bt2
._UserFilterComponent
,
290 message_iterator_class
=MyIter
):
291 def __init__(comp_self
, params
):
292 port1
= comp_self
._add
_output
_port
('clear')
293 port2
= comp_self
._add
_output
_port
('print')
294 port3
= comp_self
._add
_output
_port
('insert')
297 for port_name
, port
in comp_self
._output
_ports
.items():
298 ports
.append((port_name
, port
))
300 self
.assertEqual(ports
[0][0], 'clear')
301 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
302 self
.assertEqual(ports
[1][0], 'print')
303 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
304 self
.assertEqual(ports
[2][0], 'insert')
305 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
307 self
._create
_comp
(MyFilter
)
309 def test_user_flt_input_ports_iter(self
):
310 class MyIter(bt2
._UserMessageIterator
):
314 class MyFilter(bt2
._UserFilterComponent
,
315 message_iterator_class
=MyIter
):
316 def __init__(comp_self
, params
):
317 port1
= comp_self
._add
_input
_port
('clear')
318 port2
= comp_self
._add
_input
_port
('print')
319 port3
= comp_self
._add
_input
_port
('insert')
322 for port_name
, port
in comp_self
._input
_ports
.items():
323 ports
.append((port_name
, port
))
325 self
.assertEqual(ports
[0][0], 'clear')
326 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
327 self
.assertEqual(ports
[1][0], 'print')
328 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
329 self
.assertEqual(ports
[2][0], 'insert')
330 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
332 self
._create
_comp
(MyFilter
)
334 def test_user_sink_input_ports_iter(self
):
335 class MySink(bt2
._UserSinkComponent
):
336 def __init__(comp_self
, params
):
337 port1
= comp_self
._add
_input
_port
('clear')
338 port2
= comp_self
._add
_input
_port
('print')
339 port3
= comp_self
._add
_input
_port
('insert')
342 for port_name
, port
in comp_self
._input
_ports
.items():
343 ports
.append((port_name
, port
))
345 self
.assertEqual(ports
[0][0], 'clear')
346 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
347 self
.assertEqual(ports
[1][0], 'print')
348 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
349 self
.assertEqual(ports
[2][0], 'insert')
350 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
355 self
._create
_comp
(MySink
)
357 def test_gen_src_output_ports_getitem(self
):
358 class MyIter(bt2
._UserMessageIterator
):
366 class MySource(bt2
._UserSourceComponent
,
367 message_iterator_class
=MyIter
):
368 def __init__(comp_self
, params
):
369 nonlocal port1
, port2
, port3
370 port1
= comp_self
._add
_output
_port
('clear')
371 port2
= comp_self
._add
_output
_port
('print')
372 port3
= comp_self
._add
_output
_port
('insert')
374 comp
= self
._create
_comp
(MySource
)
375 self
.assertEqual(port3
.addr
, comp
.output_ports
['insert'].addr
)
376 self
.assertEqual(port2
.addr
, comp
.output_ports
['print'].addr
)
377 self
.assertEqual(port1
.addr
, comp
.output_ports
['clear'].addr
)
382 def test_gen_flt_output_ports_getitem(self
):
383 class MyIter(bt2
._UserMessageIterator
):
391 class MyFilter(bt2
._UserFilterComponent
,
392 message_iterator_class
=MyIter
):
393 def __init__(comp_self
, params
):
394 nonlocal port1
, port2
, port3
395 port1
= comp_self
._add
_output
_port
('clear')
396 port2
= comp_self
._add
_output
_port
('print')
397 port3
= comp_self
._add
_output
_port
('insert')
399 comp
= self
._create
_comp
(MyFilter
)
400 self
.assertEqual(port3
.addr
, comp
.output_ports
['insert'].addr
)
401 self
.assertEqual(port2
.addr
, comp
.output_ports
['print'].addr
)
402 self
.assertEqual(port1
.addr
, comp
.output_ports
['clear'].addr
)
407 def test_gen_flt_input_ports_getitem(self
):
408 class MyIter(bt2
._UserMessageIterator
):
416 class MyFilter(bt2
._UserFilterComponent
,
417 message_iterator_class
=MyIter
):
418 def __init__(comp_self
, params
):
419 nonlocal port1
, port2
, port3
420 port1
= comp_self
._add
_input
_port
('clear')
421 port2
= comp_self
._add
_input
_port
('print')
422 port3
= comp_self
._add
_input
_port
('insert')
424 comp
= self
._create
_comp
(MyFilter
)
425 self
.assertEqual(port3
.addr
, comp
.input_ports
['insert'].addr
)
426 self
.assertEqual(port2
.addr
, comp
.input_ports
['print'].addr
)
427 self
.assertEqual(port1
.addr
, comp
.input_ports
['clear'].addr
)
432 def test_gen_sink_input_ports_getitem(self
):
437 class MySink(bt2
._UserSinkComponent
):
438 def __init__(comp_self
, params
):
439 nonlocal port1
, port2
, port3
440 port1
= comp_self
._add
_input
_port
('clear')
441 port2
= comp_self
._add
_input
_port
('print')
442 port3
= comp_self
._add
_input
_port
('insert')
447 comp
= self
._create
_comp
(MySink
)
448 self
.assertEqual(port3
.addr
, comp
.input_ports
['insert'].addr
)
449 self
.assertEqual(port2
.addr
, comp
.input_ports
['print'].addr
)
450 self
.assertEqual(port1
.addr
, comp
.input_ports
['clear'].addr
)
455 def test_gen_src_output_ports_getitem_invalid_key(self
):
456 class MyIter(bt2
._UserMessageIterator
):
460 class MySource(bt2
._UserSourceComponent
,
461 message_iterator_class
=MyIter
):
462 def __init__(comp_self
, params
):
463 comp_self
._add
_output
_port
('clear')
464 comp_self
._add
_output
_port
('print')
465 comp_self
._add
_output
_port
('insert')
467 comp
= self
._create
_comp
(MySource
)
469 with self
.assertRaises(KeyError):
470 comp
.output_ports
['hello']
472 def test_gen_flt_output_ports_getitem_invalid_key(self
):
473 class MyIter(bt2
._UserMessageIterator
):
477 class MyFilter(bt2
._UserFilterComponent
,
478 message_iterator_class
=MyIter
):
479 def __init__(comp_self
, params
):
480 comp_self
._add
_output
_port
('clear')
481 comp_self
._add
_output
_port
('print')
482 comp_self
._add
_output
_port
('insert')
484 comp
= self
._create
_comp
(MyFilter
)
486 with self
.assertRaises(KeyError):
487 comp
.output_ports
['hello']
489 def test_gen_flt_input_ports_getitem_invalid_key(self
):
490 class MyIter(bt2
._UserMessageIterator
):
494 class MyFilter(bt2
._UserFilterComponent
,
495 message_iterator_class
=MyIter
):
496 def __init__(comp_self
, params
):
497 comp_self
._add
_input
_port
('clear')
498 comp_self
._add
_input
_port
('print')
499 comp_self
._add
_input
_port
('insert')
501 comp
= self
._create
_comp
(MyFilter
)
503 with self
.assertRaises(KeyError):
504 comp
.input_ports
['hello']
506 def test_gen_sink_input_ports_getitem_invalid_key(self
):
507 class MySink(bt2
._UserSinkComponent
):
508 def __init__(comp_self
, params
):
509 comp_self
._add
_input
_port
('clear')
510 comp_self
._add
_input
_port
('print')
511 comp_self
._add
_input
_port
('insert')
513 with self
.assertRaises(KeyError):
514 comp_self
._input
_ports
['hello']
519 comp
= self
._create
_comp
(MySink
)
521 with self
.assertRaises(KeyError):
522 comp
.input_ports
['hello']
524 def test_gen_src_output_ports_len(self
):
525 class MyIter(bt2
._UserMessageIterator
):
529 class MySource(bt2
._UserSourceComponent
,
530 message_iterator_class
=MyIter
):
531 def __init__(comp_self
, params
):
532 comp_self
._add
_output
_port
('clear')
533 comp_self
._add
_output
_port
('print')
534 comp_self
._add
_output
_port
('insert')
536 comp
= self
._create
_comp
(MySource
)
537 self
.assertEqual(len(comp
.output_ports
), 3)
539 def test_gen_flt_output_ports_len(self
):
540 class MyIter(bt2
._UserMessageIterator
):
544 class MyFilter(bt2
._UserFilterComponent
,
545 message_iterator_class
=MyIter
):
546 def __init__(comp_self
, params
):
547 comp_self
._add
_output
_port
('clear')
548 comp_self
._add
_output
_port
('print')
549 comp_self
._add
_output
_port
('insert')
551 comp
= self
._create
_comp
(MyFilter
)
552 self
.assertEqual(len(comp
.output_ports
), 3)
554 def test_gen_flt_input_ports_len(self
):
555 class MyIter(bt2
._UserMessageIterator
):
559 class MyFilter(bt2
._UserFilterComponent
,
560 message_iterator_class
=MyIter
):
561 def __init__(comp_self
, params
):
562 comp_self
._add
_input
_port
('clear')
563 comp_self
._add
_input
_port
('print')
564 comp_self
._add
_input
_port
('insert')
566 comp
= self
._create
_comp
(MyFilter
)
567 self
.assertEqual(len(comp
.input_ports
), 3)
569 def test_gen_sink_input_ports_len(self
):
570 class MySink(bt2
._UserSinkComponent
):
571 def __init__(comp_self
, params
):
572 comp_self
._add
_input
_port
('clear')
573 comp_self
._add
_input
_port
('print')
574 comp_self
._add
_input
_port
('insert')
579 comp
= self
._create
_comp
(MySink
)
580 self
.assertEqual(len(comp
.input_ports
), 3)
582 def test_gen_src_output_ports_iter(self
):
583 class MyIter(bt2
._UserMessageIterator
):
591 class MySource(bt2
._UserSourceComponent
,
592 message_iterator_class
=MyIter
):
593 def __init__(comp_self
, params
):
594 nonlocal port1
, port2
, port3
595 port1
= comp_self
._add
_output
_port
('clear')
596 port2
= comp_self
._add
_output
_port
('print')
597 port3
= comp_self
._add
_output
_port
('insert')
599 comp
= self
._create
_comp
(MySource
)
602 for port_name
, port
in comp
.output_ports
.items():
603 ports
.append((port_name
, port
))
605 self
.assertEqual(ports
[0][0], 'clear')
606 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
607 self
.assertEqual(ports
[1][0], 'print')
608 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
609 self
.assertEqual(ports
[2][0], 'insert')
610 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
615 def test_gen_flt_output_ports_iter(self
):
616 class MyIter(bt2
._UserMessageIterator
):
624 class MyFilter(bt2
._UserFilterComponent
,
625 message_iterator_class
=MyIter
):
626 def __init__(comp_self
, params
):
627 nonlocal port1
, port2
, port3
628 port1
= comp_self
._add
_output
_port
('clear')
629 port2
= comp_self
._add
_output
_port
('print')
630 port3
= comp_self
._add
_output
_port
('insert')
632 comp
= self
._create
_comp
(MyFilter
)
635 for port_name
, port
in comp
.output_ports
.items():
636 ports
.append((port_name
, port
))
638 self
.assertEqual(ports
[0][0], 'clear')
639 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
640 self
.assertEqual(ports
[1][0], 'print')
641 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
642 self
.assertEqual(ports
[2][0], 'insert')
643 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
648 def test_gen_flt_input_ports_iter(self
):
649 class MyIter(bt2
._UserMessageIterator
):
657 class MyFilter(bt2
._UserFilterComponent
,
658 message_iterator_class
=MyIter
):
659 def __init__(comp_self
, params
):
660 nonlocal port1
, port2
, port3
661 port1
= comp_self
._add
_input
_port
('clear')
662 port2
= comp_self
._add
_input
_port
('print')
663 port3
= comp_self
._add
_input
_port
('insert')
665 comp
= self
._create
_comp
(MyFilter
)
668 for port_name
, port
in comp
.input_ports
.items():
669 ports
.append((port_name
, port
))
671 self
.assertEqual(ports
[0][0], 'clear')
672 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
673 self
.assertEqual(ports
[1][0], 'print')
674 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
675 self
.assertEqual(ports
[2][0], 'insert')
676 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
681 def test_gen_sink_input_ports_iter(self
):
686 class MySink(bt2
._UserSinkComponent
):
687 def __init__(comp_self
, params
):
688 nonlocal port1
, port2
, port3
689 port1
= comp_self
._add
_input
_port
('clear')
690 port2
= comp_self
._add
_input
_port
('print')
691 port3
= comp_self
._add
_input
_port
('insert')
696 comp
= self
._create
_comp
(MySink
)
699 for port_name
, port
in comp
.input_ports
.items():
700 ports
.append((port_name
, port
))
702 self
.assertEqual(ports
[0][0], 'clear')
703 self
.assertEqual(ports
[0][1].addr
, port1
.addr
)
704 self
.assertEqual(ports
[1][0], 'print')
705 self
.assertEqual(ports
[1][1].addr
, port2
.addr
)
706 self
.assertEqual(ports
[2][0], 'insert')
707 self
.assertEqual(ports
[2][1].addr
, port3
.addr
)
713 class MySink(bt2
._UserSinkComponent
):
714 def __init__(comp_self
, params
):
715 comp_self
._add
_input
_port
('clear')
720 comp
= self
._create
_comp
(MySink
)
721 self
.assertEqual(comp
.input_ports
['clear'].name
, 'clear')
723 def test_connection_none(self
):
724 class MySink(bt2
._UserSinkComponent
):
725 def __init__(comp_self
, params
):
726 comp_self
._add
_input
_port
('clear')
731 comp
= self
._create
_comp
(MySink
)
732 self
.assertIsNone(comp
.input_ports
['clear'].connection
)
734 def test_is_connected_false(self
):
735 class MySink(bt2
._UserSinkComponent
):
736 def __init__(comp_self
, params
):
737 comp_self
._add
_input
_port
('clear')
742 comp
= self
._create
_comp
(MySink
)
743 self
.assertFalse(comp
.input_ports
['clear'].is_connected
)
745 def test_self_name(self
):
746 class MySink(bt2
._UserSinkComponent
):
747 def __init__(comp_self
, params
):
748 port
= comp_self
._add
_input
_port
('clear')
749 self
.assertEqual(port
.name
, 'clear')
754 self
._create
_comp
(MySink
)
756 def test_self_connection_none(self
):
757 class MySink(bt2
._UserSinkComponent
):
758 def __init__(comp_self
, params
):
759 port
= comp_self
._add
_input
_port
('clear')
760 self
.assertIsNone(port
.connection
)
765 self
._create
_comp
(MySink
)
767 def test_self_is_connected_false(self
):
768 class MySink(bt2
._UserSinkComponent
):
769 def __init__(comp_self
, params
):
770 port
= comp_self
._add
_input
_port
('clear')
771 self
.assertFalse(port
.is_connected
)
776 self
._create
_comp
(MySink
)
This page took 0.048198 seconds and 5 git commands to generate.