Skip to content

Commit 8e6e6d7

Browse files
committed
add unittest
1 parent ed96bae commit 8e6e6d7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

python/paddle/fluid/tests/unittests/test_flip.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,23 @@ def test_grad(self):
198198
self.func(p)
199199

200200

201+
class TestFlipError(unittest.TestCase):
202+
def test_axis(self):
203+
paddle.enable_static()
204+
205+
def test_axis_rank():
206+
input = fluid.data(name='input', dtype='float32', shape=[2, 3])
207+
output = paddle.flip(input, axis=[[0]])
208+
209+
self.assertRaises(TypeError, test_axis_rank)
210+
211+
def test_axis_rank2():
212+
input = fluid.data(name='input', dtype='float32', shape=[2, 3])
213+
output = paddle.flip(input, axis=[[0, 0], [1, 1]])
214+
215+
self.assertRaises(TypeError, test_axis_rank2)
216+
217+
201218
if __name__ == "__main__":
202219
paddle.enable_static()
203220
unittest.main()

0 commit comments

Comments
 (0)