(
view: t.Union[dp.App, dp.Blocks], expected_attachments: int = None, expected_num_blocks: int = None
)
| 42 | |
| 43 | |
| 44 | def assert_view( |
| 45 | view: t.Union[dp.App, dp.Blocks], expected_attachments: int = None, expected_num_blocks: int = None |
| 46 | ) -> t.Tuple[str, t.List[t.BinaryIO]]: |
| 47 | state = _view_to_xml_and_files(view) |
| 48 | view_xml = state.view_xml |
| 49 | attachments = state.store.file_list |
| 50 | if expected_attachments: |
| 51 | assert len(attachments) == expected_attachments |
| 52 | if expected_num_blocks: |
| 53 | assert num_blocks(view_xml) == expected_num_blocks |
| 54 | assert validate_view_doc(xml_str=view_xml) |
| 55 | return (view_xml, attachments) |
| 56 | |
| 57 | |
| 58 | ################################################################################ |
no test coverage detected