code: def test_asfortranarray():
      # dtype different
      raw_a = np.random.rand(2, 4)
      raw_b = np.asfortranarray(raw_a, dtype="f4")
  
      a = tensor(raw_a, chunk_size=2)
      b = asfortranarray(a, dtype="f4")
  
      assert a.dtype == raw_a.dtype
      assert a.flags["C_CONTIGUOUS"] == raw_a.flags["C_CONTIGUOUS"]
      assert a.flags["F_CONTIGUOUS"] == raw_a.flags["F_CONTIGUOUS"]
  
      assert b.dtype == raw_b.dtype
      assert b.flags["C_CONTIGUOUS"] == raw_b.flags["C_CONTIGUOUS"]
      assert b.flags["F_CONTIGUOUS"] == raw_b.flags["F_CONTIGUOUS"]
  
      # no copy
      raw_a = np.asfortranarray(np.random.rand(2, 4))
      raw_b = np.asfortranarray(raw_a)
  
      a = tensor(raw_a, chunk_size=2)
      b = asfortranarray(a)
  
      assert a.dtype == raw_a.dtype
      assert a.flags["C_CONTIGUOUS"] == raw_a.flags["C_CONTIGUOUS"]
      assert a.flags["F_CONTIGUOUS"] == raw_a.flags["F_CONTIGUOUS"]
  
      assert b.dtype == raw_b.dtype
      assert b.flags["C_CONTIGUOUS"] == raw_b.flags["C_CONTIGUOUS"]
      assert b.flags["F_CONTIGUOUS"] == raw_b.flags["F_CONTIGUOUS"]
  
imports: import shutil
  import tempfile
  from copy import copy
  import numpy
  import scipy.sparse
  import pytest
  from ....None import dataframe
  from ....core import enter_mode, tile
  from ...None import ones, zeros, tensor, full, arange, diag, linspace, triu, tril, ones_like
  from ...core import Tensor, SparseTensor
  from ..None import array, fromtiledb, TensorTileDBDataSource, fromdense, asarray, ascontiguousarray, asfortranarray
  from ..tri import TensorTriu, TensorTril
  from ..zeros import TensorZeros
  from ..from_dense import DenseToSparse
  from ..array import CSRMatrixDataSource
  from ..ones import TensorOnes, TensorOnesLike
  from ..from_dataframe import from_dataframe
label_desc: Use image node_id 3 for calling a global function with example usage: test_asfortranarray() without return types