code: def test_parse_shorthand_with_data(object_dtype):
      def check(s, data, **kwargs):
          assert parse_shorthand(s, data) == kwargs
  
      data = pd.DataFrame(
          {
              "x": [1, 2, 3, 4, 5],
              "y": ["A", "B", "C", "D", "E"],
              "z": pd.date_range("2018-01-01", periods=5, freq="D"),
              "t": pd.date_range(
                  "2018-01-01", periods=5, freq="D"
              ).tz_localize("UTC"),
          }
      )
  
      if object_dtype:
          data = data.astype("object")
  
      check("x", data, field="x", type="quantitative")
      check("y", data, field="y", type="nominal")
      check("z", data, field="z", type="temporal")
      check("t", data, field="t", type="temporal")
      check(
          "count(x)",
          data,
          field="x",
          aggregate="count",
          type="quantitative",
      )
      check("count()", data, aggregate="count", type="quantitative")
      check(
          "month(z)", data, timeUnit="month", field="z", type="temporal"
      )
      check(
          "month(t)", data, timeUnit="month", field="t", type="temporal"
      )
  
      if PANDAS_VERSION >= Version("1.0.0"):
          data["b"] = pd.Series(
              [True, False, True, False, None], dtype="boolean"
          )
          check("b", data, field="b", type="nominal")
  
imports: import types
  from packaging.version import Version
  from importlib.metadata import version
  import numpy
  import pandas
  import pytest
  import altair
  from altair.utils.core import parse_shorthand, update_nested, infer_encoding_types
  from altair.utils.core import infer_dtype
label_desc: Use image node_id 3 for calling a global function with example usage: test_parse_shorthand_with_data(object_dtype) without return types