Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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