tests: make sure the type error is the one we want

This commit is contained in:
Daniel Schadt 2016-09-15 16:42:02 +02:00
parent 794eb84805
commit eabfdb3c16

View File

@ -355,18 +355,27 @@ class TestRegister:
"""Blah."""
pass
with pytest.raises(TypeError):
with pytest.raises(TypeError) as excinfo:
fun = cmdutils.register()(fun)
expected = ("fun: handler has keyword only argument 'target' without "
"default!")
assert str(excinfo.value) == expected
def test_typed_keyword_only_without_default(self):
# https://github.com/The-Compiler/qutebrowser/issues/1872
def fun(*, target: int):
"""Blah."""
pass
with pytest.raises(TypeError):
with pytest.raises(TypeError) as excinfo:
fun = cmdutils.register()(fun)
expected = ("fun: handler has keyword only argument 'target' without "
"default!")
assert str(excinfo.value) == expected
class TestArgument: