def get_test_classes_for_model(test_file, model_class):
    """Get all [test] classes in `test_file` that have `model_class` in their `all_model_classes`."""
    test_classes = get_test_classes(test_file)

    target_test_classes = []
    for test_class in test_classes:
        if model_class in test_class.all_model_classes:
            target_test_classes.append(test_class)

    # sort with class names
    return sorted(target_test_classes, key=lambda x: x.__name__)
Get all [test] classes in `test_file` that have `model_class` in their `all_model_classes`.
dpkd/transformers/utils/get_test_info.py