def test_can_return_compatible_type():
    """Test that we can return a different type that has the same fields,
    for example when returning a Django Model.
    """

    @dataclass
    class Example:
        name: str

    @strawberry.type
    class Cheese:
        name: str

    @strawberry.type
    class Query:
        @strawberry.field
        def assortment(self) -> Cheese:
            return Example(name="Asiago")  # type: ignore

    schema = strawberry.Schema(query=Query)

    query = """{
        assortment {
            name
        }
    }"""

    result = schema.execute_sync(query)

    assert not result.errors
    assert result.data["assortment"]["name"] == "Asiago"
Test that we can return a different type that has the same fields,
    for example when returning a Django Model.
    
tests/schema/test_basic.py