Esempio n. 1
0
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''')
Esempio n. 2
0
 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'))
Esempio n. 3
0
def test_no_such_argument_str(name):
    exc = quiz.NoSuchArgument(name)
    assert str(exc) == 'argument "{}" does not exist'.format(name)