def METHOD_NAME(
    entity: Text, regex_features: Dict[Text, Text], expected_patterns: Dict[Text, Text]
):
    training_data = TrainingData()
    if entity:
        training_data.training_examples = [
            Message(
                data={
                    "text": "text",
                    "intent": "greet",
                    "entities": [{"entity": entity, "value": "text"}],
                }
            )
        ]
    if regex_features:
        training_data.regex_features = [regex_features]
    actual_patterns = pattern_utils.extract_patterns(
        training_data, use_only_entities=True
    )
    assert actual_patterns == expected_patterns