def testPeriodOne(self):
    """Tests that the function is called every time if period == 1."""
    target = tf.Variable(0)

    periodic_update = periodic_ops.periodically(
        body=lambda: target.assign_add(1).op, period=1)

    with self.test_session() as sess:
      sess.run(tf.global_variables_initializer())
      for desired_value in range(1, 11):
        _, result = sess.run([periodic_update, target])
        self.assertEqual(desired_value, result)
Tests that the function is called every time if period == 1.
trfl/periodic_ops_test.py