def test_extension_changing_field_return_value():
    """Ensure that field extensions can change the field's return type."""

    class ChangeReturnTypeExtension(FieldExtension):
        def apply(self, field: StrawberryField) -> None:
            field.type_annotation = StrawberryAnnotation.from_annotation(int)

        def resolve(self, next_, source, info, **kwargs: Any):
            return next_(source, info, **kwargs)

    @strawberry.type
    class Query:
        @strawberry.field(extensions=[ChangeReturnTypeExtension()])
        def test_changing_return_type(self) -> bool: ...

    schema = strawberry.Schema(query=Query)
    expected = """\
      type Query {
        testChangingReturnType: Int!
      }
    """
    assert str(schema) == textwrap.dedent(expected).strip()
Ensure that field extensions can change the field's return type.
tests/fields/test_field_exceptions.py