code: def test_scalars_stack(gdb_arrow):
      check_stack_repr(gdb_arrow, "null_scalar", "arrow::NullScalar")
      check_stack_repr(
          gdb_arrow, "bool_scalar", "arrow::BooleanScalar of value true"
      )
      check_stack_repr(
          gdb_arrow,
          "bool_scalar_null",
          "arrow::BooleanScalar of null value",
      )
      check_stack_repr(
          gdb_arrow, "int8_scalar", "arrow::Int8Scalar of value -42"
      )
      check_stack_repr(
          gdb_arrow, "uint8_scalar", "arrow::UInt8Scalar of value 234"
      )
      check_stack_repr(
          gdb_arrow,
          "int64_scalar",
          "arrow::Int64Scalar of value -9223372036854775808",
      )
      check_stack_repr(
          gdb_arrow,
          "uint64_scalar",
          "arrow::UInt64Scalar of value 18446744073709551615",
      )
      check_stack_repr(
          gdb_arrow,
          "half_float_scalar",
          "arrow::HalfFloatScalar of value -1.5 [48640]",
      )
      check_stack_repr(
          gdb_arrow, "float_scalar", "arrow::FloatScalar of value 1.25"
      )
      check_stack_repr(
          gdb_arrow, "double_scalar", "arrow::DoubleScalar of value 2.5"
      )
  
      check_stack_repr(
          gdb_arrow,
          "time_scalar_s",
          "arrow::Time32Scalar of value 100s",
      )
      check_stack_repr(
          gdb_arrow,
          "time_scalar_ms",
          "arrow::Time32Scalar of value 1000ms",
      )
      check_stack_repr(
          gdb_arrow,
          "time_scalar_us",
          "arrow::Time64Scalar of value 10000us",
      )
      check_stack_repr(
          gdb_arrow,
          "time_scalar_ns",
          "arrow::Time64Scalar of value 100000ns",
      )
      check_stack_repr(
          gdb_arrow,
          "time_scalar_null",
          "arrow::Time64Scalar of null value [ns]",
      )
  
      check_stack_repr(
          gdb_arrow,
          "duration_scalar_s",
          "arrow::DurationScalar of value -100s",
      )
      check_stack_repr(
          gdb_arrow,
          "duration_scalar_ms",
          "arrow::DurationScalar of value -1000ms",
      )
      check_stack_repr(
          gdb_arrow,
          "duration_scalar_us",
          "arrow::DurationScalar of value -10000us",
      )
      check_stack_repr(
          gdb_arrow,
          "duration_scalar_ns",
          "arrow::DurationScalar of value -100000ns",
      )
      check_stack_repr(
          gdb_arrow,
          "duration_scalar_null",
          "arrow::DurationScalar of null value [ns]",
      )
  
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_s",
          "arrow::TimestampScalar of value 12345s [no timezone]",
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_ms",
          "arrow::TimestampScalar of value -123456ms [no timezone]",
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_us",
          "arrow::TimestampScalar of value 1234567us [no timezone]",
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_ns",
          "arrow::TimestampScalar of value -12345678ns [no timezone]",
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_null",
          "arrow::TimestampScalar of null value [ns, no timezone]",
      )
  
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_s_tz",
          'arrow::TimestampScalar of value 12345s ["Europe/Paris"]',
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_ms_tz",
          'arrow::TimestampScalar of value -123456ms ["Europe/Paris"]',
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_us_tz",
          'arrow::TimestampScalar of value 1234567us ["Europe/Paris"]',
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_ns_tz",
          'arrow::TimestampScalar of value -12345678ns ["Europe/Paris"]',
      )
      check_stack_repr(
          gdb_arrow,
          "timestamp_scalar_null_tz",
          'arrow::TimestampScalar of null value [ns, "Europe/Paris"]',
      )
  
      check_stack_repr(
          gdb_arrow,
          "month_interval_scalar",
          "arrow::MonthIntervalScalar of value 23M",
      )
      check_stack_repr(
          gdb_arrow,
          "month_interval_scalar_null",
          "arrow::MonthIntervalScalar of null value",
      )
      check_stack_repr(
          gdb_arrow,
          "day_time_interval_scalar",
          "arrow::DayTimeIntervalScalar of value 23d-456ms",
      )
      check_stack_repr(
          gdb_arrow,
          "day_time_interval_scalar_null",
          "arrow::DayTimeIntervalScalar of null value",
      )
      check_stack_repr(
          gdb_arrow,
          "month_day_nano_interval_scalar",
          "arrow::MonthDayNanoIntervalScalar of value 1M23d-456ns",
      )
      check_stack_repr(
          gdb_arrow,
          "month_day_nano_interval_scalar_null",
          "arrow::MonthDayNanoIntervalScalar of null value",
      )
  
      check_stack_repr(
          gdb_arrow,
          "date32_scalar",
          "arrow::Date32Scalar of value 23d [1970-01-24]",
      )
      check_stack_repr(
          gdb_arrow,
          "date32_scalar_null",
          "arrow::Date32Scalar of null value",
      )
      check_stack_repr(
          gdb_arrow,
          "date64_scalar",
          "arrow::Date64Scalar of value 3888000000ms [1970-02-15]",
      )
      check_stack_repr(
          gdb_arrow,
          "date64_scalar_null",
          "arrow::Date64Scalar of null value",
      )
  
      check_stack_repr(
          gdb_arrow,
          "decimal128_scalar_null",
          "arrow::Decimal128Scalar of null value [precision=10, scale=4]",
      )
      check_stack_repr(
          gdb_arrow,
          "decimal128_scalar_pos_scale_pos",
          "arrow::Decimal128Scalar of value 123.4567 [precision=10, scale=4]",
      )
      check_stack_repr(
          gdb_arrow,
          "decimal128_scalar_pos_scale_neg",
          "arrow::Decimal128Scalar of value -123.4567 [precision=10, scale=4]",
      )
      check_stack_repr(
          gdb_arrow,
          "decimal128_scalar_neg_scale_pos",
          (
              "arrow::Decimal128Scalar of value 1.234567e+10 "
              "[precision=10, scale=-4]"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "decimal128_scalar_neg_scale_neg",
          (
              "arrow::Decimal128Scalar of value -1.234567e+10 "
              "[precision=10, scale=-4]"
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "decimal256_scalar_null",
          "arrow::Decimal256Scalar of null value [precision=50, scale=4]",
      )
      check_stack_repr(
          gdb_arrow,
          "decimal256_scalar_pos_scale_pos",
          (
              "arrow::Decimal256Scalar of value "
              "123456789012345678901234567890123456789012.3456 "
              "[precision=50, scale=4]"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "decimal256_scalar_pos_scale_neg",
          (
              "arrow::Decimal256Scalar of value "
              "-123456789012345678901234567890123456789012.3456 "
              "[precision=50, scale=4]"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "decimal256_scalar_neg_scale_pos",
          (
              "arrow::Decimal256Scalar of value "
              "1.234567890123456789012345678901234567890123456e+49 "
              "[precision=50, scale=-4]"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "decimal256_scalar_neg_scale_neg",
          (
              "arrow::Decimal256Scalar of value "
              "-1.234567890123456789012345678901234567890123456e+49 "
              "[precision=50, scale=-4]"
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "binary_scalar_null",
          "arrow::BinaryScalar of null value",
      )
      check_stack_repr(
          gdb_arrow,
          "binary_scalar_unallocated",
          "arrow::BinaryScalar of value <unallocated>",
      )
      check_stack_repr(
          gdb_arrow,
          "binary_scalar_empty",
          'arrow::BinaryScalar of size 0, value ""',
      )
      check_stack_repr(
          gdb_arrow,
          "binary_scalar_abc",
          'arrow::BinaryScalar of size 3, value "abc"',
      )
      check_stack_repr(
          gdb_arrow,
          "binary_scalar_bytes",
          r'arrow::BinaryScalar of size 3, value "\000\037\377"',
      )
      check_stack_repr(
          gdb_arrow,
          "large_binary_scalar_abc",
          'arrow::LargeBinaryScalar of size 3, value "abc"',
      )
  
      check_stack_repr(
          gdb_arrow,
          "string_scalar_null",
          "arrow::StringScalar of null value",
      )
      check_stack_repr(
          gdb_arrow,
          "string_scalar_unallocated",
          "arrow::StringScalar of value <unallocated>",
      )
      check_stack_repr(
          gdb_arrow,
          "string_scalar_empty",
          'arrow::StringScalar of size 0, value ""',
      )
      check_stack_repr(
          gdb_arrow,
          "string_scalar_hehe",
          'arrow::StringScalar of size 6, value "héhé"',
      )
      # FIXME: excessive escaping ('\\xff' vs. '\x00')
      check_stack_repr(
          gdb_arrow,
          "string_scalar_invalid_chars",
          r'arrow::StringScalar of size 11, value "abc\x00def\\xffghi"',
      )
      check_stack_repr(
          gdb_arrow,
          "large_string_scalar_hehe",
          'arrow::LargeStringScalar of size 6, value "héhé"',
      )
  
      check_stack_repr(
          gdb_arrow,
          "fixed_size_binary_scalar",
          'arrow::FixedSizeBinaryScalar of size 3, value "abc"',
      )
      check_stack_repr(
          gdb_arrow,
          "fixed_size_binary_scalar_null",
          'arrow::FixedSizeBinaryScalar of size 3, null with value "   "',
      )
  
      check_stack_repr(
          gdb_arrow,
          "dict_scalar",
          re.compile(
              (
                  r"^arrow::DictionaryScalar of index "
                  r"arrow::Int8Scalar of value 42, "
                  r"dictionary arrow::StringArray "
              )
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "dict_scalar_null",
          (
              "arrow::DictionaryScalar of type "
              "arrow::dictionary(arrow::int8(), arrow::utf8(), ordered=false), "
              "null value"
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "list_scalar",
          (
              "arrow::ListScalar of value arrow::Int32Array of "
              "length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "list_scalar_null",
          "arrow::ListScalar of type arrow::list(arrow::int32()), null value",
      )
      check_stack_repr(
          gdb_arrow,
          "large_list_scalar",
          (
              "arrow::LargeListScalar of value arrow::Int32Array of "
              "length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "large_list_scalar_null",
          (
              "arrow::LargeListScalar of type arrow::large_list(arrow::int32()), "
              "null value"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "fixed_size_list_scalar",
          (
              "arrow::FixedSizeListScalar of value arrow::Int32Array of "
              "length 3, offset 0, null count 0 = {[0] = 4, [1] = 5, [2] = 6}"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "fixed_size_list_scalar_null",
          (
              "arrow::FixedSizeListScalar of type "
              "arrow::fixed_size_list(arrow::int32(), 3), null value"
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "struct_scalar",
          (
              'arrow::StructScalar = {["ints"] = arrow::Int32Scalar of value 42, '
              '["strs"] = arrow::StringScalar of size 9, value "some text"}'
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "struct_scalar_null",
          (
              "arrow::StructScalar of type arrow::struct_("
              '{arrow::field("ints", arrow::int32()), '
              'arrow::field("strs", arrow::utf8())}), null value'
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "sparse_union_scalar",
          (
              "arrow::SparseUnionScalar of type code 7, "
              "value arrow::Int32Scalar of value 43"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "sparse_union_scalar_null",
          re.compile(
              r"^arrow::SparseUnionScalar of type arrow::sparse_union\(.*\), "
              r"type code 7, null value$"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "dense_union_scalar",
          (
              "arrow::DenseUnionScalar of type code 7, "
              "value arrow::Int32Scalar of value 43"
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "dense_union_scalar_null",
          re.compile(
              r"^arrow::DenseUnionScalar of type arrow::dense_union\(.*\), "
              r"type code 7, null value$"
          ),
      )
  
      check_stack_repr(
          gdb_arrow,
          "extension_scalar",
          (
              'arrow::ExtensionScalar of type "extension<uuid>", '
              "value arrow::FixedSizeBinaryScalar of size 16, "
              'value "0123456789abcdef"'
          ),
      )
      check_stack_repr(
          gdb_arrow,
          "extension_scalar_null",
          'arrow::ExtensionScalar of type "extension<uuid>", null value',
      )
  
imports: from functools import lru_cache
  import os
  import re
  import shutil
  import subprocess
  import sys
  import pytest
  import pyarrow
label_desc: Use image node_id 21 for calling a global function with example usage: test_scalars_stack(gdb_arrow) without return types