예제 #1
0
 def test_print_tensors(self):
   try:
     out_capturer = six.StringIO()
     sys.stdout = out_capturer
     with self.test_session() as sess:
       sess.run(py_builtins.print_(constant_op.constant('test message'), 1))
       self.assertEqual(out_capturer.getvalue(), 'test message 1\n')
   finally:
     sys.stdout = sys.__stdout__
예제 #2
0
 def test_print_tensors(self):
   try:
     out_capturer = six.StringIO()
     sys.stdout = out_capturer
     with self.cached_session() as sess:
       sess.run(py_builtins.print_(constant_op.constant('test message'), 1))
       self.assertEqual(out_capturer.getvalue(), 'test message 1\n')
   finally:
     sys.stdout = sys.__stdout__
 def test_print_complex(self):
   try:
     out_capturer = six.StringIO()
     sys.stdout = out_capturer
     with self.cached_session() as sess:
       sess.run(
           py_builtins.print_(constant_op.constant('test message'), [1, 2]))
       self.assertEqual(out_capturer.getvalue(), 'test message [1, 2]\n')
   finally:
     sys.stdout = sys.__stdout__
 def test_print_complex(self):
     try:
         out_capturer = six.StringIO()
         sys.stdout = out_capturer
         with self.test_session() as sess:
             sess.run(
                 py_builtins.print_(constant_op.constant('test message'),
                                    [1, 2]))
             self.assertEqual(out_capturer.getvalue(),
                              'test message [1, 2]\n')
     finally:
         sys.stdout = sys.__stdout__