code: def test_date_cast():
      # ARROW-10472 - casting fo scalars doesn't segfault
      scalar = pa.scalar(
          datetime.datetime(2012, 1, 1), type=pa.timestamp("us")
      )
      expected = datetime.date(2012, 1, 1)
      for ty in [pa.date32(), pa.date64()]:
          result = scalar.cast(ty)
          assert result.as_py() == expected
  
imports: import datetime
  import decimal
  import pytest
  import sys
  import weakref
  import numpy
  import pyarrow
  import pyarrow.compute
  from pyarrow.tests import util
label_desc: Use image node_id 13 for calling a global function with example usage: test_date_cast() without return types