未验证 提交 888631b6 编写于 作者: N Nyakku Shigure 提交者: GitHub

[CodeStyle][isort][Dy2St] sort imports in test_error (#48746)

* [CodeStyle][isort][Dy2St] sort imports in test_error

* update lineno
上级 e4ee872c
...@@ -19,6 +19,5 @@ extend_skip_glob = [ ...@@ -19,6 +19,5 @@ extend_skip_glob = [
"python/paddle/fluid/tests/unittests/mlu/**", "python/paddle/fluid/tests/unittests/mlu/**",
# These files will be fixed in the future # These files will be fixed in the future
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py",
"python/paddle/jit/**", "python/paddle/jit/**",
] ]
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import inspect import inspect
import os
import unittest import unittest
import numpy as np import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.jit.dy2static import error from paddle.jit.dy2static import error
...@@ -254,11 +256,11 @@ class TestErrorStaticLayerCallInCompiletime(TestErrorBase): ...@@ -254,11 +256,11 @@ class TestErrorStaticLayerCallInCompiletime(TestErrorBase):
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 33, in func_error_in_compile_time'.format( 'File "{}", line 35, in func_error_in_compile_time'.format(
self.filepath self.filepath
), ),
'inner_func()', 'inner_func()',
'File "{}", line 26, in inner_func'.format(self.filepath), 'File "{}", line 28, in inner_func'.format(self.filepath),
'def inner_func():', 'def inner_func():',
'fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")', 'fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")',
'<--- HERE', '<--- HERE',
...@@ -285,7 +287,7 @@ class TestErrorStaticLayerCallInCompiletime_2( ...@@ -285,7 +287,7 @@ class TestErrorStaticLayerCallInCompiletime_2(
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 44, in func_error_in_compile_time_2'.format( 'File "{}", line 46, in func_error_in_compile_time_2'.format(
self.filepath self.filepath
), ),
'def func_error_in_compile_time_2(x):', 'def func_error_in_compile_time_2(x):',
...@@ -311,7 +313,7 @@ class TestErrorStaticLayerCallInCompiletime_3( ...@@ -311,7 +313,7 @@ class TestErrorStaticLayerCallInCompiletime_3(
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 89, in forward'.format(self.filepath), 'File "{}", line 91, in forward'.format(self.filepath),
'@paddle.jit.to_static', '@paddle.jit.to_static',
'def forward(self):', 'def forward(self):',
'self.test_func()', 'self.test_func()',
...@@ -335,7 +337,7 @@ class TestErrorStaticLayerCallInRuntime(TestErrorStaticLayerCallInCompiletime): ...@@ -335,7 +337,7 @@ class TestErrorStaticLayerCallInRuntime(TestErrorStaticLayerCallInCompiletime):
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 52, in func_error_in_runtime'.format( 'File "{}", line 54, in func_error_in_runtime'.format(
self.filepath self.filepath
), ),
'x = fluid.dygraph.to_variable(x)', 'x = fluid.dygraph.to_variable(x)',
...@@ -352,7 +354,7 @@ class TestErrorStaticLayerCallInRuntime2(TestErrorStaticLayerCallInRuntime): ...@@ -352,7 +354,7 @@ class TestErrorStaticLayerCallInRuntime2(TestErrorStaticLayerCallInRuntime):
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 104, in func_error_in_runtime_with_empty_line'.format( 'File "{}", line 106, in func_error_in_runtime_with_empty_line'.format(
self.filepath self.filepath
), ),
'two = fluid.layers.fill_constant(shape=[1], value=2, dtype="int32")', 'two = fluid.layers.fill_constant(shape=[1], value=2, dtype="int32")',
...@@ -399,7 +401,7 @@ class TestJitSaveInCompiletime(TestErrorBase): ...@@ -399,7 +401,7 @@ class TestJitSaveInCompiletime(TestErrorBase):
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 78, in forward'.format(self.filepath), 'File "{}", line 80, in forward'.format(self.filepath),
'def forward(self, x):', 'def forward(self, x):',
'y = self._linear(x)', 'y = self._linear(x)',
'z = fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")', 'z = fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")',
...@@ -433,9 +435,9 @@ class TestSuggestionErrorInRuntime(TestErrorBase): ...@@ -433,9 +435,9 @@ class TestSuggestionErrorInRuntime(TestErrorBase):
def set_message(self): def set_message(self):
self.expected_message = [ self.expected_message = [
'File "{}", line 116, in forward'.format(self.filepath), 'File "{}", line 118, in forward'.format(self.filepath),
'return self.inner_net.forward(x)', 'return self.inner_net.forward(x)',
'File "{}", line 125, in forward'.format(self.filepath), 'File "{}", line 127, in forward'.format(self.filepath),
'def forward(self, x):', 'def forward(self, x):',
'out = paddle.matmul(self.w, x)', 'out = paddle.matmul(self.w, x)',
'<--- HERE', '<--- HERE',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册