Add test case for __rdiv__ in python 2
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
1c241df19f
commit
12eadc6a00
@ -35,6 +35,15 @@ class DimensionDivTest(test_util.TensorFlowTestCase):
|
|||||||
for y in values:
|
for y in values:
|
||||||
self.assertEqual((x / y).value, (x // y).value)
|
self.assertEqual((x / y).value, (x // y).value)
|
||||||
|
|
||||||
|
def testRDivFail(self):
|
||||||
|
# Note: This test is related to GitHub issue 25790.
|
||||||
|
"""Without from __future__ import division, __rdiv__ is used."""
|
||||||
|
if six.PY2: # Old division exists only in Python 2
|
||||||
|
two = tensor_shape.Dimension(2)
|
||||||
|
message = (r"unsupported operand type\(s\) for \/: "
|
||||||
|
r"'int' and 'Dimension', please use \/\/ instead")
|
||||||
|
with self.assertRaisesRegexp(TypeError, message):
|
||||||
|
_ = 6 / two
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
googletest.main()
|
googletest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user