For some locations, such as https://github.com/openPMD/openPMD-validator/pull/44#issuecomment-389203924, a hand-written error string instead of a regex can be more valuable to users. let's add this as an optional parameter to the `test_attr` function.