Skip to content

Refactor deprecated unittest aliases for Python 3.11 compatibility. - #560

Merged
Legrandin merged 1 commit into
Legrandin:masterfrom
tirkarthi:fix-assert
Oct 10, 2021
Merged

Legrandin merged 1 commit into
Legrandin:masterfrom
tirkarthi:fix-assert

Conversation

@tirkarthi

Copy link
Copy Markdown
Contributor

Ref : python/cpython#28268 . Aliases are present in Python 2.7 too. So the PR is backwards compatible and is a straightforward find and replace.

perl -pi -e 's/assertEquals/assertEqual/g' **/*py
perl -pi -e 's/failIf/assertFalse/g' **/*py
perl -pi -e 's/failUnless/assertTrue/g' **/*py

Command to find aliases :

rg -t py 'assertEquals|assertNotEquals|assertAlmostEquals|assertNotAlmostEquals|assertRegexpMatches|assertNotRegexpMatches|assertRaisesRegexp|failUnlessEqual|failIfEqual|failUnlessAlmostEqual|failUnless|failUnlessRaises|failIf'

@Legrandin
Legrandin merged commit 28a2e8c into Legrandin:master Oct 10, 2021
@Legrandin

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants