tests: make sure the type error is the one we want
This commit is contained in:
parent
794eb84805
commit
eabfdb3c16
@ -355,18 +355,27 @@ class TestRegister:
|
|||||||
"""Blah."""
|
"""Blah."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError) as excinfo:
|
||||||
fun = cmdutils.register()(fun)
|
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):
|
def test_typed_keyword_only_without_default(self):
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/1872
|
# https://github.com/The-Compiler/qutebrowser/issues/1872
|
||||||
def fun(*, target: int):
|
def fun(*, target: int):
|
||||||
"""Blah."""
|
"""Blah."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError) as excinfo:
|
||||||
fun = cmdutils.register()(fun)
|
fun = cmdutils.register()(fun)
|
||||||
|
|
||||||
|
expected = ("fun: handler has keyword only argument 'target' without "
|
||||||
|
"default!")
|
||||||
|
assert str(excinfo.value) == expected
|
||||||
|
|
||||||
|
|
||||||
class TestArgument:
|
class TestArgument:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user