class_docstr: Test that broadcasting works as expected for the reduced_dm functions
class_docstr_tok: ["Test","that","broadcasting","works","as","expected","for","the","reduced_dm","functions"]
docstr: Test that broadcasting works for density matrices and single wires
docstr_tok: ["Test","that","broadcasting","works","for","density","matrices","and","single","wires"]
code: def test_reduced_dm_with_matrix_single_wires(self, wires, array_func):
      """Test that broadcasting works for density matrices and single wires"""
      density_matrix = array_func(
          [dm[0] for dm in density_matrices[:4]]
      )
      expected_density_matrices = array_func(
          [dm[1][wires[0]] for dm in density_matrices[:4]]
      )
  
      density_matrix = fn.reduce_dm(density_matrix, indices=wires)
      assert np.allclose(density_matrix, expected_density_matrices)
  
imports: import numpy
  import pytest
  from pennylane import numpy
  from pennylane import math
label_desc: Use image node_id 3 for calling the TestDensityMatrixBroadcasting obj's underlying member method code with example usage: obj.test_reduced_dm_with_matrix_single_wires(wires, array_func) without return types