A comment, wherever it is, must be the one of the item now at that position, and every item id in `kept` must still have its comment.
(bl, kept)
| 40 | |
| 41 | |
| 42 | def check_comments(bl, kept): |
| 43 | """ |
| 44 | A comment, wherever it is, must be the one of the item now at that position, and every |
| 45 | item id in `kept` must still have its comment. |
| 46 | """ |
| 47 | seen = set() |
| 48 | for i, item in enumerate(bl): |
| 49 | comment = bl.get_comment(i) |
| 50 | if comment is None: |
| 51 | continue |
| 52 | assert isinstance(item, Box), f"comment {comment} on non item {item!r} at {i}" |
| 53 | assert comment == {"eol": f"c{item.id}"}, f"position {i} holds item {item.id} but has comment {comment}" |
| 54 | seen.add(item.id) |
| 55 | missing = set(kept) - seen |
| 56 | assert not missing, f"comments lost for items {sorted(missing)}" |
| 57 | |
| 58 | |
| 59 | def check_converted(bl, **options): |
no test coverage detected