Add test case for error message of Dimension div (/)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
7e5d6c25f4
commit
1c241df19f
@ -205,6 +205,23 @@ class DimensionTest(test_util.TensorFlowTestCase):
|
||||
reconstructed = ctor(*args)
|
||||
self.assertEquals(reconstructed, dim)
|
||||
|
||||
def testDiv(self):
|
||||
# Note: This test is related to GitHub issue 25790.
|
||||
six = tensor_shape.Dimension(6)
|
||||
two = tensor_shape.Dimension(2)
|
||||
message = (r"unsupported operand type\(s\) for \/: "
|
||||
r"'Dimension' and 'Dimension', please use \/\/ instead")
|
||||
with self.assertRaisesRegexp(TypeError, message):
|
||||
_ = six / two
|
||||
message = (r"unsupported operand type\(s\) for \/: "
|
||||
r"'Dimension' and 'int', please use \/\/ instead")
|
||||
with self.assertRaisesRegexp(TypeError, message):
|
||||
_ = six / 2
|
||||
message = (r"unsupported operand type\(s\) for \/: "
|
||||
r"'int' and 'Dimension', please use \/\/ instead")
|
||||
with self.assertRaisesRegexp(TypeError, message):
|
||||
_ = 6 / two
|
||||
|
||||
|
||||
class ShapeTest(test_util.TensorFlowTestCase):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user