Use callback.assert_called_with()

This commit is contained in:
Florian Bruhin 2018-09-27 10:06:50 +02:00
parent 4352d9dcee
commit 56b8447fb9
6 changed files with 8 additions and 8 deletions

View File

@ -31,7 +31,7 @@ pytest-cov==2.6.0
pytest-faulthandler==1.5.0 pytest-faulthandler==1.5.0
pytest-instafail==0.4.0 pytest-instafail==0.4.0
pytest-mock==1.10.0 pytest-mock==1.10.0
pytest-qt==3.1.0 pytest-qt==3.2.0
pytest-repeat==0.7.0 pytest-repeat==0.7.0
pytest-rerunfailures==4.1 pytest-rerunfailures==4.1
pytest-travis-fold==1.3.0 pytest-travis-fold==1.3.0

View File

@ -298,7 +298,7 @@ class TestSearch:
with qtbot.wait_callback() as callback: with qtbot.wait_callback() as callback:
web_tab.search.search('fiv', result_cb=callback) web_tab.search.search('fiv', result_cb=callback)
assert callback.args == [True] callback.assert_called_with(True)
mode_manager.enter(usertypes.KeyMode.caret) mode_manager.enter(usertypes.KeyMode.caret)
caret.move_to_end_of_line() caret.move_to_end_of_line()
@ -312,11 +312,11 @@ class TestSearch:
with qtbot.wait_callback() as callback: with qtbot.wait_callback() as callback:
web_tab.search.search('w', result_cb=callback) web_tab.search.search('w', result_cb=callback)
assert callback.args == [True] callback.assert_called_with(True)
with qtbot.wait_callback() as callback: with qtbot.wait_callback() as callback:
web_tab.search.next_result(result_cb=callback) web_tab.search.next_result(result_cb=callback)
assert callback.args == [True] callback.assert_called_with(True)
mode_manager.enter(usertypes.KeyMode.caret) mode_manager.enter(usertypes.KeyMode.caret)

View File

@ -112,7 +112,7 @@ class JSTester:
""" """
with self.qtbot.wait_callback() as callback: with self.qtbot.wait_callback() as callback:
self.tab.run_js_async(source, callback, world=world) self.tab.run_js_async(source, callback, world=world)
assert callback.args == [expected] callback.assert_called_with(expected)
@pytest.fixture @pytest.fixture

View File

@ -58,7 +58,7 @@ class CaretTester:
with self._qtbot.wait_callback() as callback: with self._qtbot.wait_callback() as callback:
self.js.tab.caret.selection(lambda text: callback(text.rstrip())) self.js.tab.caret.selection(lambda text: callback(text.rstrip()))
assert callback.args == ['MARKER'] callback.assert_called_with('MARKER')
def check_scrolled(self): def check_scrolled(self):
"""Check if the page is scrolled down.""" """Check if the page is scrolled down."""

View File

@ -240,7 +240,7 @@ class TestWindowIsolation:
with qtbot.wait_callback() as callback: with qtbot.wait_callback() as callback:
page.runJavaScript(setup.test_script, callback) page.runJavaScript(setup.test_script, callback)
assert callback.args == [setup.expected] callback.assert_called_with(setup.expected)
# The JSCore in 602.1 doesn't fully support Proxy. # The JSCore in 602.1 doesn't fully support Proxy.
@pytest.mark.qtwebkit6021_skip @pytest.mark.qtwebkit6021_skip

View File

@ -78,4 +78,4 @@ def test_simple_js_webengine(qtbot, webengineview, qapp,
with qtbot.wait_callback() as callback: with qtbot.wait_callback() as callback:
page.runJavaScript('1 + 1', world, callback) page.runJavaScript('1 + 1', world, callback)
assert callback.args == [expected] callback.assert_called_with(expected)