code: def test_arraysequence_extend(self):
      new_data = generate_data(
          nb_arrays=10,
          common_shape=SEQ_DATA["seq"].common_shape,
          rng=SEQ_DATA["rng"],
      )
  
      # Extend with an empty list.
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      seq.extend([])
      check_arr_seq(seq, SEQ_DATA["data"])
  
      # Extend with a list of ndarrays.
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      seq.extend(new_data)
      check_arr_seq(seq, SEQ_DATA["data"] + new_data)
  
      # Extend with a generator.
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      seq.extend(d for d in new_data)
      check_arr_seq(seq, SEQ_DATA["data"] + new_data)
  
      # Extend with another `ArraySequence` object.
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      seq.extend(ArraySequence(new_data))
      check_arr_seq(seq, SEQ_DATA["data"] + new_data)
  
      # Extend with an `ArraySequence` view (e.g. been sliced).
      # Need to make sure we extend only the data we need.
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      seq.extend(ArraySequence(new_data)[::2])
      check_arr_seq(seq, SEQ_DATA["data"] + new_data[::2])
  
      # Test extending an empty ArraySequence
      seq = ArraySequence()
      seq.extend(ArraySequence())
      check_empty_arr_seq(seq)
  
      seq.extend(SEQ_DATA["seq"])
      check_arr_seq(seq, SEQ_DATA["data"])
  
      # Extend with elements of different shape.
      data = generate_data(
          nb_arrays=10,
          common_shape=SEQ_DATA["seq"].common_shape * 2,
          rng=SEQ_DATA["rng"],
      )
      seq = SEQ_DATA[
          "seq"
      ].copy()  # Copy because of in-place modification.
      with pytest.raises(ValueError):
          seq.extend(data)
  
      # Extend after extracting some slice
      working_slice = seq[:2]
      seq.extend(ArraySequence(new_data))
  
imports: import itertools
  import os
  import sys
  import tempfile
  import unittest
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ...testing import assert_arrays_equal
  from ..array_sequence import ArraySequence, concatenate, is_array_sequence
label_desc: Use image node_id 8 for calling the TestArraySequence obj's underlying member method code with example usage: obj.test_arraysequence_extend() without return types