Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#9 from 0x45f/fix-ut1
Browse files Browse the repository at this point in the history
test warning ast only
  • Loading branch information
2742195759 committed Jun 19, 2023
2 parents 9d5c54f + fdc47ac commit c2fe354
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/dygraph_to_static/test_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import unittest
import warnings

from dygraph_to_static_util import ast_only_test, dy2static_unittest

import paddle
from paddle.static.nn import cond

Expand All @@ -37,12 +39,14 @@ def false_fn():
return [paddle.to_tensor(3), [None, paddle.to_tensor(4)]]


@dy2static_unittest
class TestReturnNoneInIfelse(unittest.TestCase):
@ast_only_test
def test_dy2static_warning(self):
paddle.disable_static()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
fun1()
paddle.jit.to_static(fun1)()
flag = False
for warn in w:
if (
Expand Down

0 comments on commit c2fe354

Please sign in to comment.