def test_selection_error_str(): exc = quiz.SelectionError(Dog, 'best_friend.foo', quiz.NoSuchArgument('bla')) assert str(exc).strip() == dedent('''\ SelectionError on "Dog" at path "best_friend.foo": NoSuchArgument: argument "bla" does not exist''')
def test_invalid_argument(self): with pytest.raises(quiz.SelectionError) as exc: quiz.validate(Dog, _.knows_command( foo=1, command=Command.SIT)) assert exc.value == quiz.SelectionError( Dog, 'knows_command', quiz.NoSuchArgument('foo'))
def test_no_such_argument_str(name): exc = quiz.NoSuchArgument(name) assert str(exc) == 'argument "{}" does not exist'.format(name)