Use metaclass instead of class decorator.

Better coverage and less code.