Skip to content

Commit

Permalink
[CodeStyle][isort][Dy2St] sort imports in test_error (PaddlePaddle#48746
Browse files Browse the repository at this point in the history
)

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

* update lineno
  • Loading branch information
SigureMo authored Dec 6, 2022
1 parent 125b08c commit b7718f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ extend_skip_glob = [
"python/paddle/fluid/tests/unittests/mlu/**",

# These files will be fixed in the future
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py",
"python/paddle/jit/**",
]
22 changes: 12 additions & 10 deletions python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import inspect
import os
import unittest

import numpy as np

import paddle
import paddle.fluid as fluid
from paddle.jit.dy2static import error
Expand Down Expand Up @@ -254,11 +256,11 @@ def set_exception_type(self):

def set_message(self):
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
),
'inner_func()',
'File "{}", line 26, in inner_func'.format(self.filepath),
'File "{}", line 28, in inner_func'.format(self.filepath),
'def inner_func():',
'fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")',
'<--- HERE',
Expand All @@ -285,7 +287,7 @@ def set_exception_type(self):

def set_message(self):
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
),
'def func_error_in_compile_time_2(x):',
Expand All @@ -311,7 +313,7 @@ def set_exception_type(self):

def set_message(self):
self.expected_message = [
'File "{}", line 89, in forward'.format(self.filepath),
'File "{}", line 91, in forward'.format(self.filepath),
'@paddle.jit.to_static',
'def forward(self):',
'self.test_func()',
Expand All @@ -335,7 +337,7 @@ def set_exception_type(self):

def set_message(self):
self.expected_message = [
'File "{}", line 52, in func_error_in_runtime'.format(
'File "{}", line 54, in func_error_in_runtime'.format(
self.filepath
),
'x = fluid.dygraph.to_variable(x)',
Expand All @@ -352,7 +354,7 @@ def set_func(self):

def set_message(self):
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
),
'two = fluid.layers.fill_constant(shape=[1], value=2, dtype="int32")',
Expand Down Expand Up @@ -399,7 +401,7 @@ def set_exception_type(self):

def set_message(self):
self.expected_message = [
'File "{}", line 78, in forward'.format(self.filepath),
'File "{}", line 80, in forward'.format(self.filepath),
'def forward(self, x):',
'y = self._linear(x)',
'z = fluid.layers.fill_constant(shape=[1, 2], value=9, dtype="int")',
Expand Down Expand Up @@ -433,9 +435,9 @@ def set_exception_type(self):

def set_message(self):
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)',
'File "{}", line 125, in forward'.format(self.filepath),
'File "{}", line 127, in forward'.format(self.filepath),
'def forward(self, x):',
'out = paddle.matmul(self.w, x)',
'<--- HERE',
Expand Down

0 comments on commit b7718f3

Please sign in to comment.