code: def test_serialize_nested_list():
      data = np.array(
          [
              [0, 1, 2, 3, 4, 5, 6],
              [0, 1, 2, 2, 3],
              [0, 1, 2, 3, 4, 5, 6, 7],
          ],
          dtype=object,
      )
  
      serialized_data = array_to_json(data)
  
      assert len(serialized_data) == 3
  
      assert serialized_data[0]["dtype"] == "int32"
      assert serialized_data[0]["value"] == memoryview(
          np.array(data[0])
      )
  
      assert serialized_data[1]["dtype"] == "int32"
      assert serialized_data[1]["value"] == memoryview(
          np.array(data[1])
      )
  
      assert serialized_data[2]["dtype"] == "int32"
      assert serialized_data[2]["value"] == memoryview(
          np.array(data[2])
      )
  
      deserialized_data = array_from_json(serialized_data)
  
      for el, deserialized_el in zip(data, deserialized_data):
          assert np.all(el == deserialized_el)
  
      data = np.array(
          [
              [0, 1, 2, 3, 4, 5, 6],
              np.array([0, 1, 2, 2, 3]),
              [0, 1, 2, 3],
          ],
          dtype=object,
      )
  
      serialized_data = array_to_json(data)
  
      assert len(serialized_data) == 3
  
      assert serialized_data[0]["dtype"] == "int32"
      assert serialized_data[0]["value"] == memoryview(
          np.array(data[0])
      )
  
      assert serialized_data[1]["dtype"] == "int32"
      assert serialized_data[1]["value"] == memoryview(
          np.array(data[1])
      )
  
      assert serialized_data[2]["dtype"] == "int32"
      assert serialized_data[2]["value"] == memoryview(
          np.array(data[2])
      )
  
      deserialized_data = array_from_json(serialized_data)
  
      for el, deserialized_el in zip(data, deserialized_data):
          assert np.all(el == deserialized_el)
  
      data = np.array(
          [["Hello", "Hallo"], ["Coucou", "Hi", "Ciao"]], dtype=object
      )
  
      serialized_data = array_to_json(data)
  
      assert len(serialized_data) == 2
  
      assert serialized_data[0] == ["Hello", "Hallo"]
      assert serialized_data[1] == ["Coucou", "Hi", "Ciao"]
  
      deserialized_data = array_from_json(serialized_data)
  
      assert np.all(data == deserialized_data)
  
file_path: bqplot/tests/binary_serialization_test.py
imports: import bqplot
  import numpy
  import pandas
  from bqplot.traits import array_to_json, array_from_json
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_serialize_nested_list() without return types