| Conditions | 2 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 10 | |||
| 11 | @pytest.fixture |
||
| 12 | def test_objects(broadcaster_class, termination_condition_adapter): |
||
| 13 | from artificial_artwork.utils.notification import Subject |
||
| 14 | return type('O', (), { |
||
| 15 | 'broadcaster': broadcaster_class(Subject(), lambda: termination_condition_adapter.satisfied), |
||
| 16 | 'adapter': termination_condition_adapter |
||
| 17 | }) |
||
| 18 | |||
| 19 | |||
| 20 | def test_adapter(test_objects): |
||
| 21 | # subscribe adapter to broadcaster |
||
| 22 | test_objects.broadcaster.subject.attach(test_objects.adapter) |
||
| 23 | |||
| 24 | # select a loop function (from test implementations) |
||
| 25 | |||
| 26 | # iterate |
||
| 27 | iterations = test_objects.broadcaster.iterate() |
||
| 28 | |||
| 29 | # assert iterations completed are the expected nb of oiterations |
||
| 30 | assert iterations == 4 |
||
| 31 |