Shorten test IDs.

This commit is contained in:
Florian Bruhin 2015-09-16 20:25:02 +02:00
parent 7eca4acb6a
commit 88167ce4ce
4 changed files with 8 additions and 8 deletions

View File

@ -320,7 +320,7 @@ class TestWebElementWrapper:
('<fakeelem/>', '<fakeelem/>'),
('<foo>\n<bar/>\n</foo>', '<foo><bar/></foo>'),
('<foo>{}</foo>'.format('x' * 500), '<foo>{}'.format('x' * 494)),
])
], ids=['fakeelem', 'newlines', 'long'])
def test_debug_text(self, elem, xml, expected):
elem._elem.toOuterXml.return_value = xml
assert elem.debug_text() == expected
@ -594,7 +594,7 @@ class TestJavascriptEscape:
# http://qutebrowser.org:8010/builders/debian-jessie/builds/765/steps/unittests/
# 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):
"""Test javascript escaping with some expected outcomes."""
assert webelem.javascript_escape(before) == after
@ -639,7 +639,7 @@ class TestJavascriptEscape:
result = webframe.evaluateJavaScript('"{}";'.format(escaped))
assert result == text
@pytest.mark.parametrize('text', TESTS)
@pytest.mark.parametrize('text', TESTS, ids=repr)
def test_real_escape(self, webframe, qtbot, text):
"""Test javascript escaping with a real QWebPage."""
self._test_escape(text, qtbot, webframe)

View File

@ -178,7 +178,7 @@ def test_signal_name(signal, expected):
(None, {'foo': 'bar'}, "foo='bar'"),
(['foo', 'bar'], {'baz': 'fish'}, "'foo', 'bar', baz='fish'"),
(['x' * 300], None, "'{}".format('x' * 198 + '')),
])
], ids=lambda val: str(val)[:20])
def test_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)'),
(['x' * 201], "fake('{}\u2026)".format('x' * 198)),
(['foo\nbar'], r"fake('foo\nbar')"),
])
], ids=lambda val: str(val)[:20])
def test_dbg_signal(stubs, args, expected):
assert debug.dbg_signal(stubs.FakeSignal(), args) == expected

View File

@ -75,7 +75,7 @@ def test_no_err_windows(caplog, exc, name, exc_text):
('foo', '', 'foo: exception'),
('foo', 'bar', 'foo: exception\n\nbar'),
('', 'bar', 'exception\n\nbar'),
])
], ids=repr)
def test_err_windows(qtbot, qapp, pre_text, post_text, expected):
@pyqtSlot()

View File

@ -57,7 +57,7 @@ class TestCompactText:
('foo\nbar', 'foobar'),
(' foo \n bar ', 'foobar'),
('\nfoo\n', 'foo'),
])
], ids=repr)
def test_compact_text(self, text, expected):
"""Test folding of newlines."""
assert utils.compact_text(text) == expected
@ -68,7 +68,7 @@ class TestCompactText:
(5, 'foobar', 'foob' + ELLIPSIS),
(5, 'foo\nbar', 'foob' + ELLIPSIS),
(7, 'foo\nbar', 'foobar'),
])
], ids=lambda val: str(val)[:20])
def test_eliding(self, elidelength, text, expected):
"""Test eliding."""
assert utils.compact_text(text, elidelength) == expected