Factor out create/tear down of data[group|type]

... in tests.

The temporary test database exists for duration of the whole test *file*
so its important that temporary things like data_types and data_groups
are cleaned up at the end of test group.

I factored this out into the setUpClass() and tearDownClass() methods
for the test classes, and a context manager for the function-tests.