Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
0x45f committed Dec 9, 2021
1 parent 7bce35d commit 464c6df
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from paddle.fluid.dygraph.dygraph_to_static import ProgramTranslator
from paddle.fluid.dygraph.jit import declarative
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.dygraph.dygraph_to_static.utils import func_to_source_code

from ifelse_simple_func import dyfunc_with_if_else

Expand Down Expand Up @@ -344,5 +345,18 @@ def test_raise_error(self):
net.foo.train()


class TestRemoveCommentInDy2St(unittest.TestCase):
def func_with_comment(self):
# Comment1
x = paddle.to_tensor([1, 2, 3])
# Comment2
# Comment3
y = paddle.to_tensor([4, 5, 6])

def test_remove_comment(self):
code_string = func_to_source_code(self.func_with_comment)
self.assertEqual('#' not in code_string, True)


if __name__ == '__main__':
unittest.main()

1 comment on commit 464c6df

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 464c6df Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #38003 Commit ID: 464c6df contains failed CI.

🔹 Failed: PR-CI-Windows-Inference

Unknown Failed
2021-12-10 14:34:46   File "C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle\paddle\scripts\installation_validate.py", line 15, in 
2021-12-10 14:34:46 import paddle.fluid as fluid
2021-12-10 14:34:46 File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\paddle_init_.py", line 25, in
2021-12-10 14:34:46 from .fluid import monkey_patch_variable
2021-12-10 14:34:46 File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\paddle\fluid_init_.py", line 223, in
2021-12-10 14:34:46 monkey_patch_eagertensor()
2021-12-10 14:34:46 File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\paddle\fluid\eager\eager_tensor_patch_methods.py", line 23, in monkey_patch_eagertensor
2021-12-10 14:34:46 setattr(core.eager.EagerTensor, "str", str)
2021-12-10 14:34:46 AttributeError: module 'paddle.fluid.core_avx' has no attribute 'eager'
2021-12-10 14:34:46 C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle\build>goto:eof
2021-12-10 14:34:46 C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle\build>echo Test import paddle failed, will exit!
2021-12-10 14:34:46 Test import paddle failed, will exit
2021-12-10 14:34:46 C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle\build>exit /b 1
2021-12-10 14:34:46 C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle>set EXCODE=1
2021-12-10 14:34:46 C:\Users\Administrator\Downloads\workspace\a4f8724f-e701-4b5c-b63e-c68dc1f16ae6\Paddle>cd C:\Users\administrator\Downloads
2021-12-10 14:34:46 C:\Users\Administrator\Downloads>rmdir C:\Users\administrator\Downloads\workspace /s/q 2>NUL
2021-12-10 14:34:50 C:\Users\Administrator\Downloads>echo EXCODE: 1
2021-12-10 14:34:50 EXCODE: 1
2021-12-10 14:34:50 C:\Users\Administrator\Downloads>exit /b 1

Please sign in to comment.