Shorten test IDs.
This commit is contained in:
parent
7eca4acb6a
commit
88167ce4ce
@ -320,7 +320,7 @@ class TestWebElementWrapper:
|
|||||||
('<fakeelem/>', '<fakeelem/>'),
|
('<fakeelem/>', '<fakeelem/>'),
|
||||||
('<foo>\n<bar/>\n</foo>', '<foo><bar/></foo>'),
|
('<foo>\n<bar/>\n</foo>', '<foo><bar/></foo>'),
|
||||||
('<foo>{}</foo>'.format('x' * 500), '<foo>{}…'.format('x' * 494)),
|
('<foo>{}</foo>'.format('x' * 500), '<foo>{}…'.format('x' * 494)),
|
||||||
])
|
], ids=['fakeelem', 'newlines', 'long'])
|
||||||
def test_debug_text(self, elem, xml, expected):
|
def test_debug_text(self, elem, xml, expected):
|
||||||
elem._elem.toOuterXml.return_value = xml
|
elem._elem.toOuterXml.return_value = xml
|
||||||
assert elem.debug_text() == expected
|
assert elem.debug_text() == expected
|
||||||
@ -594,7 +594,7 @@ class TestJavascriptEscape:
|
|||||||
# http://qutebrowser.org:8010/builders/debian-jessie/builds/765/steps/unittests/
|
# http://qutebrowser.org:8010/builders/debian-jessie/builds/765/steps/unittests/
|
||||||
# Should that be ignored?
|
# Should that be ignored?
|
||||||
|
|
||||||
@pytest.mark.parametrize('before, after', TESTS.items())
|
@pytest.mark.parametrize('before, after', TESTS.items(), ids=repr)
|
||||||
def test_fake_escape(self, before, after):
|
def test_fake_escape(self, before, after):
|
||||||
"""Test javascript escaping with some expected outcomes."""
|
"""Test javascript escaping with some expected outcomes."""
|
||||||
assert webelem.javascript_escape(before) == after
|
assert webelem.javascript_escape(before) == after
|
||||||
@ -639,7 +639,7 @@ class TestJavascriptEscape:
|
|||||||
result = webframe.evaluateJavaScript('"{}";'.format(escaped))
|
result = webframe.evaluateJavaScript('"{}";'.format(escaped))
|
||||||
assert result == text
|
assert result == text
|
||||||
|
|
||||||
@pytest.mark.parametrize('text', TESTS)
|
@pytest.mark.parametrize('text', TESTS, ids=repr)
|
||||||
def test_real_escape(self, webframe, qtbot, text):
|
def test_real_escape(self, webframe, qtbot, text):
|
||||||
"""Test javascript escaping with a real QWebPage."""
|
"""Test javascript escaping with a real QWebPage."""
|
||||||
self._test_escape(text, qtbot, webframe)
|
self._test_escape(text, qtbot, webframe)
|
||||||
|
@ -178,7 +178,7 @@ def test_signal_name(signal, expected):
|
|||||||
(None, {'foo': 'bar'}, "foo='bar'"),
|
(None, {'foo': 'bar'}, "foo='bar'"),
|
||||||
(['foo', 'bar'], {'baz': 'fish'}, "'foo', 'bar', baz='fish'"),
|
(['foo', 'bar'], {'baz': 'fish'}, "'foo', 'bar', baz='fish'"),
|
||||||
(['x' * 300], None, "'{}".format('x' * 198 + '…')),
|
(['x' * 300], None, "'{}".format('x' * 198 + '…')),
|
||||||
])
|
], ids=lambda val: str(val)[:20])
|
||||||
def test_format_args(args, kwargs, expected):
|
def test_format_args(args, kwargs, expected):
|
||||||
assert debug.format_args(args, kwargs) == expected
|
assert debug.format_args(args, kwargs) == expected
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ def test_format_call(func, args, kwargs, full, expected):
|
|||||||
([23, 42], 'fake(23, 42)'),
|
([23, 42], 'fake(23, 42)'),
|
||||||
(['x' * 201], "fake('{}\u2026)".format('x' * 198)),
|
(['x' * 201], "fake('{}\u2026)".format('x' * 198)),
|
||||||
(['foo\nbar'], r"fake('foo\nbar')"),
|
(['foo\nbar'], r"fake('foo\nbar')"),
|
||||||
])
|
], ids=lambda val: str(val)[:20])
|
||||||
def test_dbg_signal(stubs, args, expected):
|
def test_dbg_signal(stubs, args, expected):
|
||||||
assert debug.dbg_signal(stubs.FakeSignal(), args) == expected
|
assert debug.dbg_signal(stubs.FakeSignal(), args) == expected
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ def test_no_err_windows(caplog, exc, name, exc_text):
|
|||||||
('foo', '', 'foo: exception'),
|
('foo', '', 'foo: exception'),
|
||||||
('foo', 'bar', 'foo: exception\n\nbar'),
|
('foo', 'bar', 'foo: exception\n\nbar'),
|
||||||
('', 'bar', 'exception\n\nbar'),
|
('', 'bar', 'exception\n\nbar'),
|
||||||
])
|
], ids=repr)
|
||||||
def test_err_windows(qtbot, qapp, pre_text, post_text, expected):
|
def test_err_windows(qtbot, qapp, pre_text, post_text, expected):
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
@ -57,7 +57,7 @@ class TestCompactText:
|
|||||||
('foo\nbar', 'foobar'),
|
('foo\nbar', 'foobar'),
|
||||||
(' foo \n bar ', 'foobar'),
|
(' foo \n bar ', 'foobar'),
|
||||||
('\nfoo\n', 'foo'),
|
('\nfoo\n', 'foo'),
|
||||||
])
|
], ids=repr)
|
||||||
def test_compact_text(self, text, expected):
|
def test_compact_text(self, text, expected):
|
||||||
"""Test folding of newlines."""
|
"""Test folding of newlines."""
|
||||||
assert utils.compact_text(text) == expected
|
assert utils.compact_text(text) == expected
|
||||||
@ -68,7 +68,7 @@ class TestCompactText:
|
|||||||
(5, 'foobar', 'foob' + ELLIPSIS),
|
(5, 'foobar', 'foob' + ELLIPSIS),
|
||||||
(5, 'foo\nbar', 'foob' + ELLIPSIS),
|
(5, 'foo\nbar', 'foob' + ELLIPSIS),
|
||||||
(7, 'foo\nbar', 'foobar'),
|
(7, 'foo\nbar', 'foobar'),
|
||||||
])
|
], ids=lambda val: str(val)[:20])
|
||||||
def test_eliding(self, elidelength, text, expected):
|
def test_eliding(self, elidelength, text, expected):
|
||||||
"""Test eliding."""
|
"""Test eliding."""
|
||||||
assert utils.compact_text(text, elidelength) == expected
|
assert utils.compact_text(text, elidelength) == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user