+ if fmt.strip() == 'html':
+ try:
+ tree = ET.fromstring(context.response.page)
+ except Exception as ex:
+ assert False, f"Could not parse page: {ex}\n{context.response.page}"
+
+ assert tree.tag == 'html'
+ body = tree.find('./body')
+ assert body is not None
+ assert body.find('.//script') is None
+ else:
+ assert context.response.format == fmt
+