code: def test_jsd():
      p = np.array([0.85, 0.05, 0.05, 0.05])
      q = np.array([0.25, 0.25, 0.25, 0.25])
  
      # JSD is symmetric
      np.testing.assert_almost_equal(
          jensen_shannon_divergence(p, q),
          jensen_shannon_divergence(q, p),
          4,
      )
  
      # JSD = 0 iff P=Q
      np.testing.assert_almost_equal(
          jensen_shannon_divergence(q, q), 0, 4
      )
  
file_path: popmon/tests/popmon/analysis/comparison/test_comparisons.py
imports: import numpy
  import pytest
  from popmon.analysis.comparison.comparisons import jensen_shannon_divergence, ks_prob, ks_test, kullback_leibler_divergence, population_stability_index, uu_chi2
label_desc: Use image node_id 6 for calling a global function with example usage: test_jsd() without return types