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] use np.testing.assert_array_equal instead of self.assertTrue(np.array_equal(...)) #44947

Merged
merged 6 commits into from
Aug 10, 2022

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Aug 6, 2022

PR types

Others

PR changes

Others

Describe

使用 np.testing.assert_array_equal(...) 替换 self.assertTrue(np.array_equal(...)),以优化单测报错信息

Changes

  • self.assertTrue(np.array_equal(...)) -> np.testing.assert_array_equal(...)
  • 等价情况 self.assertEqual(np.array_equal(...), True) -> np.testing.assert_array_equal(...)
  • 等价情况 self.assertTrue(numpy.array_equal(...)) -> np.testing.assert_array_equal(...)
  • 部分原来代码里的错误使用 self.assertTrue(np.array_equal(...), True) 移除 True

@paddle-bot
Copy link

paddle-bot bot commented Aug 6, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Aug 6, 2022
@SigureMo SigureMo changed the title [CodeStyle] use np.testing.assert_array_equal instead of unittest builtin assert methods [WIP][CodeStyle] use np.testing.assert_array_equal instead of unittest builtin assert methods Aug 6, 2022
@luotao1 luotao1 added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Aug 8, 2022
@SigureMo SigureMo marked this pull request as ready for review August 8, 2022 07:26
@SigureMo SigureMo changed the title [WIP][CodeStyle] use np.testing.assert_array_equal instead of unittest builtin assert methods [CodeStyle] use np.testing.assert_array_equal instead of unittest builtin assert methods Aug 8, 2022
@SigureMo SigureMo closed this Aug 8, 2022
@paddle-bot
Copy link

paddle-bot bot commented Aug 8, 2022

很抱歉,经过我们的反复讨论,你的PR暂未达到合入标准,请阅读飞桨原生算子开发规范,你可以重新提交新的PR,我们先将此PR关闭,感谢你的贡献。
Sorry to inform you that through our discussion, your PR fails to meet the merging standard (Reference: Paddle Custom Operator Design Doc). You can also submit an new one. Thank you.

@SigureMo SigureMo reopened this Aug 8, 2022
这不是修复导致的错误,这些是原来 `self.assertTrue(..., True)`
的错误用法,因此在修复后将其认为位置参数 `err_msg`
@SigureMo SigureMo changed the title [CodeStyle] use np.testing.assert_array_equal instead of unittest builtin assert methods [CodeStyle] use np.testing.assert_array_equal instead of self.assertTrue(np.array_equal(...)) Aug 8, 2022
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Copy link
Member Author

Choose a reason for hiding this comment

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

这个文件看起来全是 change 是因为原来文件是 CRLF 换行的

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants