diff --git a/python/paddle/fluid/tests/unittests/test_accuracy_op.py b/python/paddle/fluid/tests/unittests/test_accuracy_op.py index e7152a29e56b3f72f61f19139d2b5ab29fa8f95e..e4412b1b24ee6aaa1a9166f47f06c13d760b75e4 100755 --- a/python/paddle/fluid/tests/unittests/test_accuracy_op.py +++ b/python/paddle/fluid/tests/unittests/test_accuracy_op.py @@ -58,7 +58,7 @@ class TestAccuracyOpFp16(TestAccuracyOp): self.check_output(atol=1e-3) -class TestAccuracyOpError(OpTest): +class TestAccuracyOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of accuracy_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_activation_op.py b/python/paddle/fluid/tests/unittests/test_activation_op.py index e325d4afb82ce6e4d9bb2b4ad284d38d2caea7d2..fbd196ffda5c57cc7603fabc91383551d82e8a61 100644 --- a/python/paddle/fluid/tests/unittests/test_activation_op.py +++ b/python/paddle/fluid/tests/unittests/test_activation_op.py @@ -23,7 +23,7 @@ import paddle.fluid as fluid from paddle.fluid import compiler, Program, program_guard -class TestSqrtOpError(OpTest): +class TestSqrtOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of sqrt op must be Variable or numpy.ndarray. @@ -537,7 +537,7 @@ class TestELU(TestActivation): self.check_grad(['X'], 'Out', max_relative_error=0.02) -class TestELUOpError(OpTest): +class TestELUOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of elu_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py index 73b11de069c9026cb5449b72543bc9087deb6703..85ca76897b2c1461ea7f13ce7ce02148ed602955 100755 --- a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py +++ b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py @@ -484,7 +484,7 @@ class TestBilinearInterp_attr_tensor_Case3(TestBilinearInterpOp_attr_tensor): self.scale_by_1Dtensor = True -class TestBilinearInterpOpAPI(OpTest): +class TestBilinearInterpOpAPI(unittest.TestCase): def test_case(self): x = fluid.data(name="x", shape=[2, 3, 6, 6], dtype="float32") diff --git a/python/paddle/fluid/tests/unittests/test_cast_op.py b/python/paddle/fluid/tests/unittests/test_cast_op.py index 4cd0966dca10dbe0c31d5ed648938e5eee12f58c..284d7101aa0156ffd581235fa509535c01fa3bac 100644 --- a/python/paddle/fluid/tests/unittests/test_cast_op.py +++ b/python/paddle/fluid/tests/unittests/test_cast_op.py @@ -70,7 +70,7 @@ class TestCastOp3(op_test.OpTest): self.check_output(atol=1e-3) -class TestCastOpError(op_test.OpTest): +class TestCastOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of cast_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py index 56b5505bc1d5b7d8af9c9b9d64dbe8e620716fea..1ca462ebf9ee6e9ce19d7d29c6221c79234f83ae 100644 --- a/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py @@ -718,7 +718,7 @@ class TestDepthwiseConvTransposeAsymmetricPad_NHWC(TestConv2dTransposeOp): self.data_format = 'NHWC' -class TestConv2dTransposeAPI(OpTest): +class TestConv2dTransposeAPI(unittest.TestCase): def test_case1(self): data1 = fluid.layers.data( name='data1', shape=[3, 5, 5], dtype='float32') @@ -796,7 +796,7 @@ class TestConv2dTransposeAPI(OpTest): self.assertIsNotNone(results[6]) -class TestConv2dTransposeOpException(OpTest): +class TestConv2dTransposeOpException(unittest.TestCase): def test_exception(self): data = fluid.layers.data(name='data', shape=[3, 5, 5], dtype="float32") diff --git a/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py b/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py index d44bd1e449ef700eb8f1b529f152e87df207b8ca..cb48f7b55dbfbdf7cc236f0d2076469fc10303bb 100644 --- a/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py @@ -563,7 +563,7 @@ class TestCUDNNWithGroups_NHWC(TestWithGroups): self.op_type = "conv3d_transpose" -class TestConv3dTransposeAPI(OpTest): +class TestConv3dTransposeAPI(unittest.TestCase): def test_case1(self): data1 = fluid.layers.data( name='data1', shape=[3, 5, 5, 5], dtype='float32') @@ -642,7 +642,7 @@ class TestConv3dTransposeAPI(OpTest): self.assertIsNotNone(results[6]) -class TestConv3dTransposeOpException(OpTest): +class TestConv3dTransposeOpException(unittest.TestCase): def test_exception(self): data = fluid.layers.data( name='data', shape=[3, 5, 5, 5], dtype="float32") diff --git a/python/paddle/fluid/tests/unittests/test_crop_tensor_op.py b/python/paddle/fluid/tests/unittests/test_crop_tensor_op.py index 5864e15df132766992271301bdccb058fdc5d781..b9be58a291d86247258a5c3e18387c6eea0a3a14 100644 --- a/python/paddle/fluid/tests/unittests/test_crop_tensor_op.py +++ b/python/paddle/fluid/tests/unittests/test_crop_tensor_op.py @@ -217,7 +217,7 @@ class TestCropTensorOpTensorAttrCase4(TestCropTensorOpTensorAttr): self.OffsetsTensor = True -class TestCropTensorException(OpTest): +class TestCropTensorException(unittest.TestCase): def test_exception(self): input1 = fluid.data(name="input1", shape=[2, 3, 6, 6], dtype="float32") input2 = fluid.data(name="input2", shape=[2, 3, 6, 6], dtype="float16") diff --git a/python/paddle/fluid/tests/unittests/test_downpoursgd.py b/python/paddle/fluid/tests/unittests/test_downpoursgd.py index 9dbea19ca556460da7fedb13217f8b20d58a15c4..3564609e08e8a49b588a4c4d407843c58e7102ff 100644 --- a/python/paddle/fluid/tests/unittests/test_downpoursgd.py +++ b/python/paddle/fluid/tests/unittests/test_downpoursgd.py @@ -31,7 +31,7 @@ from google.protobuf import text_format import paddle.fluid.incubate.fleet.parameter_server.pslib.ps_pb2 as pslib -class TestListenAndServOp(OpTest): +class TestListenAndServOp(unittest.TestCase): """TestListenAndServOp.""" def setUp(self): diff --git a/python/paddle/fluid/tests/unittests/test_expand_op.py b/python/paddle/fluid/tests/unittests/test_expand_op.py index 910ab684f478c798690c98281ffa452235b8f0f1..05f2e520bd697728b9368c8db50c860c1cf20f55 100644 --- a/python/paddle/fluid/tests/unittests/test_expand_op.py +++ b/python/paddle/fluid/tests/unittests/test_expand_op.py @@ -193,7 +193,7 @@ class TestExpandOpInt64_t(OpTest): self.check_output() -class TestExpandError(OpTest): +class TestExpandError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): x1 = fluid.create_lod_tensor( @@ -208,7 +208,7 @@ class TestExpandError(OpTest): # Test python API -class TestExpandAPI(OpTest): +class TestExpandAPI(unittest.TestCase): def test_api(self): input = np.random.random([12, 14]).astype("float32") x = fluid.layers.data( diff --git a/python/paddle/fluid/tests/unittests/test_fc_op.py b/python/paddle/fluid/tests/unittests/test_fc_op.py index 9028210b8fe9cc7ee4b6af3598ea0bc79fa2cde0..1105dcee7b448d1e7481c628d4864a53614e1304 100644 --- a/python/paddle/fluid/tests/unittests/test_fc_op.py +++ b/python/paddle/fluid/tests/unittests/test_fc_op.py @@ -131,7 +131,7 @@ class TestFCOpWithPadding(TestFCOp): self.matrix = MatrixGenerate(1, 4, 3, 128, 128, 2) -class TestFCOpError(OpTest): +class TestFCOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): input_data = np.random.random((2, 4)).astype("float32") diff --git a/python/paddle/fluid/tests/unittests/test_fetch_var.py b/python/paddle/fluid/tests/unittests/test_fetch_var.py index 14eb4c4ed78eaa1c9e6bb6e2ba481ceda2e9ba61..d78b27566ebc3cae6788688312c94cbe0c5b607b 100644 --- a/python/paddle/fluid/tests/unittests/test_fetch_var.py +++ b/python/paddle/fluid/tests/unittests/test_fetch_var.py @@ -21,7 +21,7 @@ import numpy import unittest -class TestFetchVar(op_test.OpTest): +class TestFetchVar(unittest.TestCase): def set_input(self): self.val = numpy.array([1, 3, 5]).astype(numpy.int32) diff --git a/python/paddle/fluid/tests/unittests/test_fl_listen_and_serv_op.py b/python/paddle/fluid/tests/unittests/test_fl_listen_and_serv_op.py index b9a58b6df5f989ff3563f4cfe442beb77d7f307e..e98551152686f1862c59ad4ebae7146c32bbd23c 100644 --- a/python/paddle/fluid/tests/unittests/test_fl_listen_and_serv_op.py +++ b/python/paddle/fluid/tests/unittests/test_fl_listen_and_serv_op.py @@ -91,7 +91,7 @@ def run_pserver(use_cuda, sync_mode, ip, port, trainers, trainer_id): exe.run(main_program) -class TestFlListenAndServOp(OpTest): +class TestFlListenAndServOp(unittest.TestCase): def setUp(self): self.ps_timeout = 5 self.ip = "127.0.0.1" diff --git a/python/paddle/fluid/tests/unittests/test_group_norm_op.py b/python/paddle/fluid/tests/unittests/test_group_norm_op.py index e2b4e146406985a8341feec0e8e858e1184f2db6..68584a4c91c7d11033927bf5a72e763d076579dc 100644 --- a/python/paddle/fluid/tests/unittests/test_group_norm_op.py +++ b/python/paddle/fluid/tests/unittests/test_group_norm_op.py @@ -222,7 +222,7 @@ class TestGroupNormAPI_With_NHWC(OpTest): self.assertTrue(np.allclose(results[1], expect_res2[0])) -class TestGroupNormException(OpTest): +class TestGroupNormException(unittest.TestCase): # data_layout is not NHWC or NCHW def test_exception(self): data = fluid.data(name='data', shape=[None, 3, 3, 4], dtype="float32") diff --git a/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py b/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py index 50902f7941b01f0b87361d226b3bfddf523fdecd..811d48452e3a0a6878fcd771debafb2639f922d4 100644 --- a/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py @@ -214,7 +214,7 @@ class TestLookupTableApi(unittest.TestCase): return_numpy=False) -class TestEmbedOpError(OpTest): +class TestEmbedOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): input_data = np.random.randint(0, 10, (4, 6)).astype("int64") diff --git a/python/paddle/fluid/tests/unittests/test_mul_op.py b/python/paddle/fluid/tests/unittests/test_mul_op.py index 85947e5c329030706cdf5b9f3123f5734e96d8a0..21d350170bf67ca26e43374f087d38fe8eb6cd47 100644 --- a/python/paddle/fluid/tests/unittests/test_mul_op.py +++ b/python/paddle/fluid/tests/unittests/test_mul_op.py @@ -51,7 +51,7 @@ class TestMulOp(OpTest): ['X'], 'Out', max_relative_error=0.5, no_grad_set=set('Y')) -class TestMulOpError(OpTest): +class TestMulOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of mul_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_one_hot_op.py b/python/paddle/fluid/tests/unittests/test_one_hot_op.py index 0ff44058d44660f68182743ddf29cc11f1025850..b1884b7e7a96f8e5448bc371a1ec1336814081fa 100644 --- a/python/paddle/fluid/tests/unittests/test_one_hot_op.py +++ b/python/paddle/fluid/tests/unittests/test_one_hot_op.py @@ -137,7 +137,7 @@ class TestOneHotOp_out_of_range(OpTest): self.check_output(check_dygraph=False) -class TestOneHotOp_exception(OpTest): +class TestOneHotOp_exception(unittest.TestCase): def setUp(self): self.op_type = 'one_hot' self.depth = 10 diff --git a/python/paddle/fluid/tests/unittests/test_one_hot_v2_op.py b/python/paddle/fluid/tests/unittests/test_one_hot_v2_op.py index 73fd00e914dce384047cf82989db044d1c9a0b1f..9901cdfef63e498f16662d6bdf0e0396030fe04e 100644 --- a/python/paddle/fluid/tests/unittests/test_one_hot_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_one_hot_v2_op.py @@ -134,7 +134,7 @@ class TestOneHotOp_out_of_range(OpTest): self.check_output(check_dygraph=False) -class TestOneHotOp_exception(OpTest): +class TestOneHotOp_exception(unittest.TestCase): def setUp(self): self.op_type = 'one_hot_v2' self.depth = 10 diff --git a/python/paddle/fluid/tests/unittests/test_pool2d_op.py b/python/paddle/fluid/tests/unittests/test_pool2d_op.py index 2f0dfc50f253e148c7b03a7d4c1c801bb49bab91..c9b26307c897cc91cfb8380eede161844e34f037 100644 --- a/python/paddle/fluid/tests/unittests/test_pool2d_op.py +++ b/python/paddle/fluid/tests/unittests/test_pool2d_op.py @@ -985,7 +985,7 @@ create_test_cudnn_padding_SAME_class(TestCase1_strides) # ----- test API -class TestPool2dAPI(OpTest): +class TestPool2dAPI(unittest.TestCase): def test_api(self): x_NHWC = np.random.random([2, 5, 5, 3]).astype("float32") x_NCHW = np.random.random([2, 3, 5, 5]).astype("float32") @@ -1204,7 +1204,7 @@ class TestPool2dAPI(OpTest): data_format="NHWC")) -class TestPool2dAPI_Error(OpTest): +class TestPool2dAPI_Error(unittest.TestCase): def test_api(self): input_NHWC = fluid.layers.data( name="input_NHWC", diff --git a/python/paddle/fluid/tests/unittests/test_reduce_op.py b/python/paddle/fluid/tests/unittests/test_reduce_op.py index 866fa05fdb04c3590ac9b1125b688282e6b2bcb3..6a62d3597f6c0449f11ee072100085b51ae34599 100644 --- a/python/paddle/fluid/tests/unittests/test_reduce_op.py +++ b/python/paddle/fluid/tests/unittests/test_reduce_op.py @@ -414,7 +414,7 @@ class Test1DReduceWithAxes1(OpTest): self.check_grad(['X'], 'Out') -class TestReduceSumOpError(OpTest): +class TestReduceSumOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of reduce_sum_op must be Variable. @@ -426,7 +426,7 @@ class TestReduceSumOpError(OpTest): self.assertRaises(TypeError, fluid.layers.reduce_sum, x2) -class TestReduceMeanOpError(OpTest): +class TestReduceMeanOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The input type of reduce_mean_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_reshape_op.py b/python/paddle/fluid/tests/unittests/test_reshape_op.py index 931d6caac55e141cb72ab4910c93f84d4041328f..277e60003a75ed894fab64ba8f5995d7e6f5ae74 100644 --- a/python/paddle/fluid/tests/unittests/test_reshape_op.py +++ b/python/paddle/fluid/tests/unittests/test_reshape_op.py @@ -186,7 +186,7 @@ class TestReshapeOpDimInfer2_attr_OnlyShape(TestReshapeOp_attr_OnlyShape): # Test python API -class TestReshapeAPI(OpTest): +class TestReshapeAPI(unittest.TestCase): # situation 1: have shape( list, no tensor), no actual shape(Tensor) def test_1(self): input = np.random.random([2, 25]).astype("float32") @@ -227,7 +227,7 @@ class TestReshapeAPI(OpTest): # Test Input Error -class TestReshapeOpError(OpTest): +class TestReshapeOpError(unittest.TestCase): def test_errors(self): with program_guard(Program(), Program()): # The x type of reshape_op must be Variable. diff --git a/python/paddle/fluid/tests/unittests/test_runtime_and_compiletime_exception.py b/python/paddle/fluid/tests/unittests/test_runtime_and_compiletime_exception.py index 9a002a31d14ea54188e8a52df9143dd2c1bcc604..83c6ad8412210dc1c264859347c19dafdac37af9 100644 --- a/python/paddle/fluid/tests/unittests/test_runtime_and_compiletime_exception.py +++ b/python/paddle/fluid/tests/unittests/test_runtime_and_compiletime_exception.py @@ -21,7 +21,7 @@ import paddle.fluid as fluid import paddle.fluid.core as core -class TestRunTimeException(OpTest): +class TestRunTimeException(unittest.TestCase): def test_run_time_exception(self): place = fluid.CPUPlace() exe = fluid.Executor(place) @@ -39,7 +39,7 @@ class TestRunTimeException(OpTest): self.assertRaises(core.EnforceNotMet, _run_program) -class TestCompileTimeException(OpTest): +class TestCompileTimeException(unittest.TestCase): def test_compile_time_exception(self): self.assertRaises(core.EnforceNotMet, self.build_model) diff --git a/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py b/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py index dec9bfa43005cc11af5ff58e10d171ec69125bd9..fee3073169920ad2fd7a4fced06f7c75ac48da2a 100644 --- a/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py +++ b/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py @@ -158,7 +158,7 @@ class TestScatterNdAddWithHighRankDiff(OpTest): #Test Python API -class TestScatterNdOpAPI(OpTest): +class TestScatterNdOpAPI(unittest.TestCase): """ test scatter_nd_add api and scatter_nd api """ @@ -231,7 +231,7 @@ class TestScatterNdOpAPI(OpTest): #Test Raise Error -class TestScatterNdOpRaise(OpTest): +class TestScatterNdOpRaise(unittest.TestCase): def test_check_raise(self): def check_raise_is_test(): try: diff --git a/python/paddle/fluid/tests/unittests/test_strided_slice_op.py b/python/paddle/fluid/tests/unittests/test_strided_slice_op.py index 8012f2e80048cf772f23a51e49f59d2fed379b8b..238fc06a20e0cd7ffcf9a286b8af49592d0884d2 100644 --- a/python/paddle/fluid/tests/unittests/test_strided_slice_op.py +++ b/python/paddle/fluid/tests/unittests/test_strided_slice_op.py @@ -438,7 +438,7 @@ class TestStridedSliceOp_strides_Tensor(OpTest): # Test python API -class TestStridedSliceAPI(OpTest): +class TestStridedSliceAPI(unittest.TestCase): def test_1(self): input = np.random.random([3, 4, 5, 6]).astype("float32") minus_1 = fluid.layers.fill_constant([1], "int32", -1)