Unit tests

TensorFlow provides a convenience class inheriting from unittest.TestCase which adds methods relevant to TensorFlow tests. Here is an example:

import tensorflow as tf

class SquareTest(tf.test.TestCase):

  def testSquare(self):
    with self.test_session():
      x = tf.square([2, 3])
      self.assertAllEqual(x.eval(), [4, 9])

if __name__ == '__main__':

tf.test.TestCase inherits from unittest.TestCase but adds a few additional methods. We will document these methods soon.


Runs all unit tests.