(self)
| 1283 | |
| 1284 | @test_util.run_v1_only('b/120545219') |
| 1285 | def testNotEntered(self): |
| 1286 | # pylint: disable=protected-access |
| 1287 | self.assertEqual(ops._default_session_stack.get_default(), None) |
| 1288 | # pylint: enable=protected-access |
| 1289 | with ops.device('/cpu:0'): |
| 1290 | sess = session.Session() |
| 1291 | c_1 = constant_op.constant(5.0) |
| 1292 | with sess.graph.as_default(): |
| 1293 | c_2 = constant_op.constant(5.0) |
| 1294 | self.assertEqual(c_1.graph, c_2.graph) |
| 1295 | self.assertEqual(sess.run(c_2), 5.0) |
| 1296 | with self.assertRaisesWithPredicateMatch( |
| 1297 | ValueError, lambda e: 'No default session is registered.' in str(e)): |
| 1298 | c_2.eval() |
| 1299 | |
| 1300 | @test_util.run_v1_only('b/120545219') |
| 1301 | def testInteractive(self): |
nothing calls this directly
no test coverage detected