Esempio n. 1
0
 def test_nested_selection_error(self):
     with pytest.raises(quiz.SelectionError) as exc:
         quiz.validate(Dog, _.owner[_.hobbies[_.foo]])
     assert exc.value == quiz.SelectionError(
         Dog, 'owner',
         quiz.SelectionError(
             Human, 'hobbies',
             quiz.SelectionError(Hobby, 'foo', quiz.NoSuchField())))
Esempio n. 2
0
 def test_no_such_field(self):
     with pytest.raises(quiz.SelectionError) as exc:
         quiz.validate(Dog, _.name.foo.knows_command(command=Command.SIT))
     assert exc.value == quiz.SelectionError(Dog, 'foo', quiz.NoSuchField())
Esempio n. 3
0
def test_no_such_field_str():
    exc = quiz.NoSuchField()
    assert str(exc) == 'field does not exist'