code: def test_strided_scalar():
      # Utility to make numpy array of given shape from scalar using striding
      for shape, scalar in product(
          ((2,), (2, 3), (2, 3, 4)),
          (1, 2, np.int16(3)),
      ):
          expected = (
              np.zeros(shape, dtype=np.array(scalar).dtype) + scalar
          )
          observed = strided_scalar(shape, scalar)
          assert_array_equal(observed, expected)
          assert observed.shape == shape
          assert observed.dtype == expected.dtype
          assert_array_equal(observed.strides, 0)
          # Strided scalars are set as not writeable
          # This addresses a numpy 1.10 breakage of broadcasting a strided
          # array without resizing (see GitHub PR #358)
          assert not observed.flags.writeable
  
          def setval(x):
              x[..., 0] = 99
  
          # RuntimeError for numpy < 1.10
          with pytest.raises((RuntimeError, ValueError)):
              setval(observed)
      # Default scalar value is 0
      assert_array_equal(strided_scalar((2, 3, 4)), np.zeros((2, 3, 4)))
  
imports: import time
  from functools import partial
  from io import BytesIO
  from itertools import product
  from threading import Lock, Thread
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ..fileslice import _positive_slice, _simple_fileslice, calc_slicedefs, canonical_slicers, fileslice, fill_slicer, is_fancy, optimize_read_slicers, optimize_slicer, predict_shape, read_segments, slice2len, slice2outax, slicers2segments, strided_scalar, threshold_heuristic
label_desc: Use image node_id 18 for calling a global function with example usage: test_strided_scalar() without return types