code: def test_basics(value, ty, klass, pickle_module):
      s = pa.scalar(value, type=ty)
      s.validate()
      s.validate(full=True)
      assert isinstance(s, klass)
      assert s.as_py() == value
      assert s == pa.scalar(value, type=ty)
      assert s != value
      assert s != "else"
      assert hash(s) == hash(s)
      assert s.is_valid is True
      assert s != None  # noqa: E711
  
      s = pa.scalar(None, type=s.type)
      assert s.is_valid is False
      assert s.as_py() is None
      assert s != pa.scalar(value, type=ty)
  
      # test pickle roundtrip
      restored = pickle_module.loads(pickle_module.dumps(s))
      assert s.equals(restored)
  
      # test that scalars are weak-referenceable
      wr = weakref.ref(s)
      assert wr() is not None
      del s
      assert wr() is None
  
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 1 for calling a global function with example usage: test_basics(value, ty, klass, pickle_module) without return types