code: def test_arithmetic_in_aggregation_3739() -> None:
      def demean_dot() -> pl.Expr:
          x = pl.col("x")
          y = pl.col("y")
          x1 = x - x.mean()
          y1 = y - y.mean()
          return (x1 * y1).sum().alias("demean_dot")
  
      assert (
          pl.DataFrame(
              {
                  "key": ["a", "a", "a", "a"],
                  "x": [4, 2, 2, 4],
                  "y": [2, 0, 2, 0],
              }
          )
          .group_by("key")
          .agg(
              [
                  demean_dot(),
              ]
          )
      ).to_dict(as_series=False) == {"key": ["a"], "demean_dot": [0.0]}
  
imports: from __future__ import annotations
  from datetime import datetime, timedelta
  from typing import Any
  import numpy
  import pandas
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 10 for calling a global function with example usage: test_arithmetic_in_aggregation_3739() and returns: unknown