class_docstr: Tests for `pairwise_distance_lib.PairwiseDistance`.
class_docstr_tok: ["Tests","for","`","pairwise_distance_lib.PairwiseDistance","`","."]
docstr: Tests that assertions still work with Keras.
docstr_tok: ["Tests","that","assertions","still","work","with","Keras","."]
code: def testAssertions(self):
      """Tests that assertions still work with Keras."""
      distance_config = configs.DistanceConfig(
          distance_type=configs.DistanceType.JENSEN_SHANNON_DIVERGENCE,
          sum_over_axis=-1,
      )
      regularizer = pairwise_distance_lib.PairwiseDistance(
          distance_config
      )
      # Try Jennsen-Shannon divergence on an improper probability distribution.
      with self.assertRaisesRegex(
          tf.errors.InvalidArgumentError,
          "x and/or y is not a proper probability distribution",
      ):
          self.evaluate(
              regularizer(
                  np.array([0.6, 0.5]), np.array([[0.25, 0.75]])
              )
          )
  
file_path: neural-structured-learning/neural_structured_learning/keras/layers/pairwise_distance_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import neural_structured_learning.configs
  from neural_structured_learning.keras.layers import pairwise_distance
  import numpy
  from scipy import special
  import tensorflow
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 4 for calling the PairwiseDistanceTest obj's underlying member method code with example usage: obj.testAssertions() without return types