

def test_web_view(qtbot):
    view = QWebView()

    def _assert(text):
        html = view.page().mainFrame().toHtml()
        assert (html == (('<html><head></head><body>' + text) + '</body></html>'))
    view.resize(100, 100)
    view.setHtml('hello')
    qtbot.addWidget(view)
    qtbot.waitForWindowShown(view)
    view.show()
    _assert('hello')
    view.setHtml('world')
    _assert('world')
    view.close()
    view = QWebView()
    view.resize(100, 100)
    view.show()
    qtbot.addWidget(view)
    view.setHtml('finished')
    _assert('finished')
    view.close()

dataset/ETHPy150Open kwikteam/phy/phy/gui/tests/test_qt.py test_web_view/original