def METHOD_NAME():
    operation_name = None
    operation_type = None
    class MyExtension(SchemaExtension):
        def on_operation(self):
            yield
            nonlocal operation_name
            nonlocal operation_type
            execution_context = self.execution_context
            operation_name = execution_context.operation_name
            operation_type = execution_context.operation_type.value
    schema = strawberry.Schema(Query, extensions=[MyExtension])
    result = schema.execute_sync("{ ping }")
    assert not result.errors
    assert operation_name is None
    assert operation_type == "query"
    # Try again with an operation_name
    result = schema.execute_sync("query MyOperation { ping }")
    assert not result.errors
    assert operation_name == "MyOperation"
    assert operation_type == "query"
    # Try again with an operation_name override
    result = schema.execute_sync(
        """
        query MyOperation { ping }
        query MyOperation2 { ping }
        """,
        operation_name="MyOperation2",
    )
    assert not result.errors
    assert operation_name == "MyOperation2"
    assert operation_type == "query"