def assert_grammar_validation(grammar_errors, test_obj):

    for attr, value, error, message in grammar_errors:
        with nt.assert_raises(error) as err:
            setattr(test_obj, attr, value)

        nt.assert_equal(err.exception.args[0], message)
Check grammar methods for validation errors
dataset/ETHPy150Open wrobstory/vincent/tests/test_vega.py/assert_grammar_validation