Fix table_name inference for tests