Class validators

Prefer pytest's parametrization feature to `for` loops, so that all the test cases can run, even if one of them fails.