docstr: Test to see if the alignment code is working as expected
          
docstr_tok: ["Test","to","see","if","the","alignment","code","is","working","as","expected"]
code: def test_differing_aligned_arrays_update(self):
      """Test to see if the alignment code is working as expected"""
  
      # Start by creating arrays that are only on various byte
      # alignments (4, 16 and 32)
      _input_array = empty_aligned(
          len(self.input_array.ravel()) * 2 + 5, dtype="float32", n=32
      )
      _output_array = empty_aligned(
          len(self.output_array.ravel()) * 2 + 5, dtype="float32", n=32
      )
  
      _input_array[:] = 0
      _output_array[:] = 0
  
      input_array_4 = numpy.frombuffer(
          _input_array[1:-4].data, dtype="complex64"
      ).reshape(self.input_array.shape)
      output_array_4 = numpy.frombuffer(
          _output_array[1:-4].data, dtype="complex64"
      ).reshape(self.output_array.shape)
  
      input_array_16 = numpy.frombuffer(
          _input_array[4:-1].data, dtype="complex64"
      ).reshape(self.input_array.shape)
      output_array_16 = numpy.frombuffer(
          _output_array[4:-1].data, dtype="complex64"
      ).reshape(self.output_array.shape)
  
      input_array_32 = numpy.frombuffer(
          _input_array[:-5].data, dtype="complex64"
      ).reshape(self.input_array.shape)
      output_array_32 = numpy.frombuffer(
          _output_array[:-5].data, dtype="complex64"
      ).reshape(self.output_array.shape)
  
      input_arrays = {
          4: input_array_4,
          16: input_array_16,
          32: input_array_32,
      }
  
      output_arrays = {
          4: output_array_4,
          16: output_array_16,
          32: output_array_32,
      }
  
      alignments = (4, 16, 32)
  
      # Test the arrays are aligned on 4 bytes...
      self.assertTrue(is_byte_aligned(input_arrays[4], n=4))
      self.assertTrue(is_byte_aligned(output_arrays[4], n=4))
  
      # ...and on 16...
      self.assertFalse(is_byte_aligned(input_arrays[4], n=16))
      self.assertFalse(is_byte_aligned(output_arrays[4], n=16))
      self.assertTrue(is_byte_aligned(input_arrays[16], n=16))
      self.assertTrue(is_byte_aligned(output_arrays[16], n=16))
  
      # ...and on 32...
      self.assertFalse(is_byte_aligned(input_arrays[16], n=32))
      self.assertFalse(is_byte_aligned(output_arrays[16], n=32))
      self.assertTrue(is_byte_aligned(input_arrays[32], n=32))
      self.assertTrue(is_byte_aligned(output_arrays[32], n=32))
  
      if len(pyfftw.pyfftw._valid_simd_alignments) > 0:
          max_align = pyfftw.pyfftw._valid_simd_alignments[0]
      else:
          max_align = simd_alignment
  
      for in_align in alignments:
          for out_align in alignments:
              expected_align = min(in_align, out_align, max_align)
              fft = FFTW(
                  input_arrays[in_align], output_arrays[out_align]
              )
  
              self.assertTrue(fft.input_alignment == expected_align)
              self.assertTrue(fft.output_alignment == expected_align)
  
              for update_align in alignments:
                  if update_align < expected_align:
                      # This should fail (not aligned properly)
                      self.assertRaisesRegex(
                          ValueError,
                          "Invalid input alignment",
                          fft.update_arrays,
                          input_arrays[update_align],
                          output_arrays[out_align],
                      )
  
                      self.assertRaisesRegex(
                          ValueError,
                          "Invalid output alignment",
                          fft.update_arrays,
                          input_arrays[in_align],
                          output_arrays[update_align],
                      )
  
                  else:
                      # This should work (and not segfault!)
                      fft.update_arrays(
                          input_arrays[update_align],
                          output_arrays[out_align],
                      )
                      fft.update_arrays(
                          input_arrays[in_align],
                          output_arrays[update_align],
                      )
                      fft.execute()
  
imports: from pyfftw import FFTW, empty_aligned, is_byte_aligned, simd_alignment
  import pyfftw
  from .test_pyfftw_base import run_test_suites, miss, require
  import unittest
  import numpy
  import warnings
label_desc: Use image node_id 5 for calling the FFTWMiscTest obj's underlying member method code with example usage: obj.test_differing_aligned_arrays_update() without return types