diff --git a/python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py b/python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py index 790213d4b029247f6dc2efb09199f7ffc4857cde..ccd23485c3d9ab2d8e94719e2ad4d07431f5bd08 100644 --- a/python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py +++ b/python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py @@ -678,7 +678,7 @@ class TestAddQuantDequantPass(unittest.TestCase): self.residual_block_quant( quantizable_op_type, skip_pattern='skip_quant', for_ci=True) - def test_residual_block_skip_pattern(self): + def test_residual_block_skip_pattern_1(self): quantizable_op_type = ['elementwise_add', 'pool2d', 'mul', 'matmul'] self.residual_block_quant( quantizable_op_type, diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py index 517cff39a276f490c2d4b6a0d951d40dc00f57b3..305bdc1468b2856f14ecf0e07de06cf57d01f5f9 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py @@ -406,7 +406,7 @@ class TestForEnumerateVarNumpyWithBreak(TestForIterVarNumpy): self.dygraph_func = for_enumerate_var_numpy_with_break -class TestForEnumerateVarNumpyWithBreak(TestForIterVarNumpy): +class TestForEnumerateVarNumpyWithContinue(TestForIterVarNumpy): def set_test_func(self): self.dygraph_func = for_enumerate_var_numpy_with_continue @@ -416,7 +416,7 @@ class TestForEnumerateVarNumpyWithStartAndBreak(TestForIterVarNumpy): self.dygraph_func = for_enumerate_var_numpy_with_start_break -class TestForEnumerateVarNumpyWithStartAndBreak(TestForIterVarNumpy): +class TestForEnumerateVarNumpyWithStartAndContinue(TestForIterVarNumpy): def set_test_func(self): self.dygraph_func = for_enumerate_var_numpy_with_start_continue diff --git a/python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py b/python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py index 4c434561e1cc11a84bef6a2f8c07ed192d028452..bd9022f56a3e77fa92c74637d5947869b201ac54 100644 --- a/python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py +++ b/python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py @@ -80,7 +80,7 @@ class TestDropoutOpInput1d(TestDropoutOp): } -class TestDropoutOpInput1d(TestDropoutOp): +class TestDropoutOpInput1d_1(TestDropoutOp): # the input is 1-D def setUp(self): self.op_type = "dropout" diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py b/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py index d0031dcc5f27d1a78f51b25e110cf9e5f0815910..4ffec9737af11f8f92d8e0a09f717dfdf423675c 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py +++ b/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py @@ -73,7 +73,7 @@ class TestSequenceReverse3(TestSequenceReverseBase): self.lod = [3, 0, 6, 3] -class TestSequenceReverse3(TestSequenceReverseBase): +class TestSequenceReverse4(TestSequenceReverseBase): def initParameters(self): self.size = (12, 10) self.lod = [0, 2, 10, 0] diff --git a/python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py index 5f3d141a502d9bd748b5a515a4eec2c3c753d490..8ef2660cac2de6df4320cfe4234c25e7ad5a16f4 100644 --- a/python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py @@ -167,7 +167,7 @@ class TestIdentityActivation(TestConv2DFusionOp): self.activation = 'identity' -class TestIdentityActivation(TestConv2DFusionOp): +class TestIdentityActivation1(TestConv2DFusionOp): def init_activation(self): self.activation = 'identity' self.add_residual_data = False diff --git a/python/paddle/fluid/tests/unittests/test_conv_nn_grad.py b/python/paddle/fluid/tests/unittests/test_conv_nn_grad.py index d5f49919bc951741e2d67e22a76633268ad8582e..81c6aa1fd17d9ad16a1d24f32e5f55b3b71ca629 100644 --- a/python/paddle/fluid/tests/unittests/test_conv_nn_grad.py +++ b/python/paddle/fluid/tests/unittests/test_conv_nn_grad.py @@ -52,7 +52,7 @@ class TestConvDoubleGradCheck(unittest.TestCase): self.func(p) -class TestConvDoubleGradCheck(unittest.TestCase): +class TestConvDoubleGradCheckTest0(unittest.TestCase): @prog_scope() def func(self, place): shape = [2, 4, 3, 3] diff --git a/python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py b/python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py index f9509d60072f877f0713d6da23018153dc138304..7c0eb83aeced6dbf760b4f041c681b705eeb6372 100644 --- a/python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py +++ b/python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py @@ -50,26 +50,6 @@ class TestDistGeoClipByGlobalNorm(TestFleetBase): self._sync_mode = False self._grad_clip_mode = 2 - def check_with_place(self, - model_file, - delta=1e-3, - check_error_log=False, - need_envs={}): - required_envs = { - "PATH": os.getenv("PATH", ""), - "PYTHONPATH": os.getenv("PYTHONPATH", ""), - "LD_LIBRARY_PATH": os.getenv("LD_LIBRARY_PATH", ""), - "FLAGS_rpc_deadline": "5000", # 5sec to fail fast - "http_proxy": "" - } - required_envs.update(need_envs) - - tr0_losses, tr1_losses = self._run_cluster(model_file, required_envs) - - def test_dist_train(self): - self.check_with_place( - "dist_fleet_ctr.py", delta=1e-5, check_error_log=True) - class TestDistASyncClipByValue(TestFleetBase): def _setup_config(self): diff --git a/python/paddle/fluid/tests/unittests/test_eye_op.py b/python/paddle/fluid/tests/unittests/test_eye_op.py index 9b541c323eceaa32591dbdc2ec149868ad7e8673..cb757cffc442598a75aee2cf2ef0b648280844bf 100644 --- a/python/paddle/fluid/tests/unittests/test_eye_op.py +++ b/python/paddle/fluid/tests/unittests/test_eye_op.py @@ -149,10 +149,10 @@ class API_TestTensorEye(unittest.TestCase): self.assertRaises(TypeError, test_num_columns_type_check) - def test_num_columns_type_check(): + def test_num_columns_type_check1(): paddle.eye(10, num_columns=10, dtype="int8") - self.assertRaises(TypeError, test_num_columns_type_check) + self.assertRaises(TypeError, test_num_columns_type_check1) if __name__ == "__main__": diff --git a/python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py b/python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py index 790cd5f3efbb4e5b2afb556e2d0a477098397709..59a8fa48d94f71630d56642e4d0133a03958e48b 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py @@ -77,40 +77,6 @@ class TestFleetRecomputeMetaOptimizer(TestFleetMetaOptimizer): ] self.assertIn('subprog', ''.join(outs)) - def test_recompute_optimizer_backward(self): - """ test recompute optimizer backward """ - train_prog, startup_prog = fluid.Program(), fluid.Program() - avg_cost, strategy = self.net(train_prog, startup_prog) - - self.set_strategy(strategy, 'recompute') - opt = fluid.optimizer.MomentumOptimizer( - learning_rate=0.001, momentum=0.9) - opt = RecomputeOptimizer(opt) - opt.user_defined_strategy = strategy - params_grads = opt.backward(avg_cost, startup_prog) - - outs = [ - op.output('Out')[0] for op in avg_cost.block.ops if op.type == 'mul' - ] - self.assertIn('subprog', ''.join(outs)) - - def test_recompute_optimizer_backward(self): - """ test recompute optimizer backward """ - train_prog, startup_prog = fluid.Program(), fluid.Program() - avg_cost, strategy = self.net(train_prog, startup_prog) - - self.set_strategy(strategy, 'recompute') - opt = fluid.optimizer.MomentumOptimizer( - learning_rate=0.001, momentum=0.9) - opt = RecomputeOptimizer(opt) - opt.user_defined_strategy = strategy - params_grads = opt.backward(avg_cost, startup_prog) - - outs = [ - op.output('Out')[0] for op in avg_cost.block.ops if op.type == 'mul' - ] - self.assertIn('subprog', ''.join(outs)) - def test_recompute_optimizer(self): train_prog, startup_prog = fluid.Program(), fluid.Program() avg_cost, strategy = self.net(train_prog, startup_prog) diff --git a/python/paddle/fluid/tests/unittests/test_gather_op.py b/python/paddle/fluid/tests/unittests/test_gather_op.py index 2d56441bf3efff373d3e118692b879d229e8b9c4..63619937315ec599230a4f4d76b1950872bae97d 100644 --- a/python/paddle/fluid/tests/unittests/test_gather_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_op.py @@ -275,10 +275,10 @@ class TestGathertError(unittest.TestCase): self.assertRaises(TypeError, test_axis_dtype) - def test_axis_dtype(): + def test_axis_dtype1(): paddle.gather(x, index, axis=axis) - self.assertRaises(TypeError, test_axis_dtype) + self.assertRaises(TypeError, test_axis_dtype1) def test_error2(self): with fluid.program_guard(fluid.Program(), fluid.Program()): diff --git a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py index cb97103e770d1a175dcd942575c047517167f1e1..9354569e34754c586ffb119ee40198817bdd6d48 100644 --- a/python/paddle/fluid/tests/unittests/test_huber_loss_op.py +++ b/python/paddle/fluid/tests/unittests/test_huber_loss_op.py @@ -76,7 +76,7 @@ def TestHuberLossOp2(TestHuberLossOp): return (6, 6) -def TestHuberLossOp2(TestHuberLossOp): +def TestHuberLossOp3(TestHuberLossOp): def set_shape(self): return (6, 6, 1) diff --git a/python/paddle/fluid/tests/unittests/test_meshgrid_op.py b/python/paddle/fluid/tests/unittests/test_meshgrid_op.py index 3f03d5ed650a8f5cb1491d7dbf2c6ff98eefd43a..10058ddae9b10a391f7eedfb156b161df3bcea0a 100644 --- a/python/paddle/fluid/tests/unittests/test_meshgrid_op.py +++ b/python/paddle/fluid/tests/unittests/test_meshgrid_op.py @@ -165,7 +165,7 @@ class TestMeshgridOp7(unittest.TestCase): assert np.array_equal(res_4.shape, [100, 200]) -class TestMeshgridOp7(unittest.TestCase): +class TestMeshgridOp8(unittest.TestCase): def test_api_with_dygraph_tuple_input(self): input_3 = np.random.randint(0, 100, [100, ]).astype('int32') input_4 = np.random.randint(0, 100, [200, ]).astype('int32') diff --git a/python/paddle/fluid/tests/unittests/test_onnx_export.py b/python/paddle/fluid/tests/unittests/test_onnx_export.py index 0985ed33af376c40e64ee93e636650a881970783..b0790b28a9224218b0a13bbbe759dfa6dea76763 100644 --- a/python/paddle/fluid/tests/unittests/test_onnx_export.py +++ b/python/paddle/fluid/tests/unittests/test_onnx_export.py @@ -52,7 +52,7 @@ class TestExportWithTensor(unittest.TestCase): paddle.onnx.export(model, 'linear_net', input_spec=[self.x_spec]) -class TestExportWithTensor(unittest.TestCase): +class TestExportWithTensor1(unittest.TestCase): def setUp(self): self.x = paddle.to_tensor(np.random.random((1, 128))) diff --git a/python/paddle/fluid/tests/unittests/test_random_seed.py b/python/paddle/fluid/tests/unittests/test_random_seed.py index 2a759d5b5464c38883cda0fe731bb79cd03fe6e0..617c0e61da8acd12e0cb20dad038f609ac06af3c 100644 --- a/python/paddle/fluid/tests/unittests/test_random_seed.py +++ b/python/paddle/fluid/tests/unittests/test_random_seed.py @@ -221,7 +221,7 @@ class TestGeneratorSeed(unittest.TestCase): self.assertTrue(np.allclose(x1_np, x2_np)) self.assertTrue(np.allclose(x_np, x3_np)) - def test_generator_uniform_random_static(self): + def test_generator_uniform_random_static_1(self): fluid.disable_dygraph() gen = paddle.seed(123123143) @@ -255,7 +255,7 @@ class TestGeneratorSeed(unittest.TestCase): self.assertTrue(np.allclose(out1_res2, out2_res2)) self.assertTrue(not np.allclose(out1_res2, out1_res1)) - def test_generator_randint_dygraph(self): + def test_generator_randint_dygraph_1(self): """Test Generator seed.""" fluid.enable_dygraph() @@ -405,7 +405,7 @@ class TestGeneratorSeed(unittest.TestCase): self.assertTrue(np.allclose(x1_np, x2_np)) self.assertTrue(np.allclose(x_np, x3_np)) - def test_generator_randperm_static(self): + def test_generator_randperm_static_1(self): fluid.disable_dygraph() 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 59d1ede5a0b534fa726722ccf021bafeb2a313f8..47dc719347adbe789927dffa1c00f07f2d219748 100644 --- a/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py +++ b/python/paddle/fluid/tests/unittests/test_scatter_nd_op.py @@ -294,7 +294,7 @@ class TestDygraph(unittest.TestCase): shape = [3, 5, 9, 10] output = paddle.scatter_nd(index, updates, shape) - def test_dygraph(self): + def test_dygraph_1(self): with fluid.dygraph.guard(fluid.CPUPlace()): x = paddle.rand(shape=[3, 5, 9, 10], dtype='float32') updates = paddle.rand(shape=[3, 9, 10], dtype='float32') diff --git a/tools/codestyle/test_docstring_checker.py b/tools/codestyle/test_docstring_checker.py index 0547f7d1610c64b0ca6efa9384e97d658c8276fe..b05983dd343ca3e44cce11b0a46d592efb26a505 100644 --- a/tools/codestyle/test_docstring_checker.py +++ b/tools/codestyle/test_docstring_checker.py @@ -38,7 +38,7 @@ class TestDocstring(pylint.testutils.CheckerTestCase): assert len(got) == 1 assert 'W9001' == got[0][0] - def test_one_line(self): + def test_one_line_1(self): func_node = astroid.extract_node(''' def test(): """get news"""