code: def test_ndarray_to_list_of_dicts(self):
      # Try different numbers of keys
      for n_keys in [1, 2, 10, 26]:
          keys = list(string.ascii_lowercase[:n_keys])
          key_set = set(keys)
          key_dict = {key: i for i, key in enumerate(keys)}
          # Try different number of walker/procs
          for N in [1, 2, 3, 10, 100]:
              x = np.random.rand(N, n_keys)
  
              LOD = ndarray_to_list_of_dicts(x, key_dict)
              assert len(LOD) == N, "need 1 dict per row"
              for i, dct in enumerate(LOD):
                  assert dct.keys() == key_set, "keys are missing"
                  for j, key in enumerate(keys):
                      assert (
                          dct[key] == x[i, j]
                      ), f"wrong value at {(i, j)}"
  
file_path: emcee/src/emcee/tests/unit/test_ensemble.py
imports: import string
  from unittest import TestCase
  import numpy
  import pytest
  from emcee.ensemble import EnsembleSampler, ndarray_to_list_of_dicts
label_desc: Use image node_id 1 for calling the TestNP2ListOfDicts obj's underlying member method code with example usage: obj.test_ndarray_to_list_of_dicts() without return types