def test_optional_scalar_with_or_operator():
    """Check `|` operator support with an optional scalar."""

    @strawberry.type
    class Query:
        date: Date | None

    schema = strawberry.Schema(query=Query)

    query = "{ date }"

    result = schema.execute_sync(query, root_value=Query(date=None))
    assert not result.errors
    assert result.data["date"] is None

    result = schema.execute_sync(query, root_value=Query(date=date(2020, 1, 1)))
    assert not result.errors
    assert result.data["date"] == "2020-01-01"
Check `|` operator support with an optional scalar.
tests/schema/test_scalars.py