aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/kernel_tests/array_ops_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/kernel_tests/array_ops_test.py')
-rw-r--r--tensorflow/python/kernel_tests/array_ops_test.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/python/kernel_tests/array_ops_test.py b/tensorflow/python/kernel_tests/array_ops_test.py
index 40567571e6..81442d12e9 100644
--- a/tensorflow/python/kernel_tests/array_ops_test.py
+++ b/tensorflow/python/kernel_tests/array_ops_test.py
@@ -245,6 +245,7 @@ class BooleanMaskTest(test_util.TensorFlowTestCase):
array_ops.boolean_mask(tensor, mask).eval()
+@test_util.run_all_in_graph_and_eager_modes
class OperatorShapeTest(test_util.TensorFlowTestCase):
def testExpandScalar(self):
@@ -262,7 +263,8 @@ class OperatorShapeTest(test_util.TensorFlowTestCase):
matrix_squeezed = array_ops.squeeze(matrix, [0])
self.assertEqual(matrix_squeezed.get_shape(), (3))
- with self.assertRaises(ValueError):
+ with self.assertRaisesRegexp(
+ Exception, "Can not squeeze dim.1., expected a dimension of 1, got 3"):
matrix_squeezed = array_ops.squeeze(matrix, [1])
def testSqueezeScalarDim(self):
@@ -270,6 +272,11 @@ class OperatorShapeTest(test_util.TensorFlowTestCase):
matrix_squeezed = array_ops.squeeze(matrix, 0)
self.assertEqual(matrix_squeezed.get_shape(), (3))
+ def testExpandDimsWithNonScalarDim(self):
+ with self.assertRaisesRegexp(Exception,
+ "must be a tensor with a single value"):
+ array_ops.expand_dims(1, axis=[0, 1])
+
class ReverseV2Test(test_util.TensorFlowTestCase):