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

gh-71339: Use new assertion methods in test_idle #129213

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

terryjreedy
Copy link
Member

@terryjreedy terryjreedy commented Jan 23, 2025

Revise 10 tests in 7 files, with 1 test split into 2.

Revise 10 tests in 7 files, with 1 test split into 2.
@terryjreedy
Copy link
Member Author

@serhiy-storchaka I did not merge in case there is some reason you did not make all these changes. Feel free to merge.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. I propose yet one change:

diff --git a/Lib/idlelib/idle_test/test_run.py b/Lib/idlelib/idle_test/test_run.py
index 83ecbffa2a1..7366a4b708c 100644
--- a/Lib/idlelib/idle_test/test_run.py
+++ b/Lib/idlelib/idle_test/test_run.py
@@ -426,7 +426,7 @@ def test_exceptions(self):
         ex.runcode('1/0')
         t, e, tb = ex.user_exc_info
         self.assertIs(t, TypeError)
-        self.assertTrue(isinstance(e.__context__, ZeroDivisionError))
+        self.assertIsInstance(e.__context__, ZeroDivisionError)
 
 
 if __name__ == '__main__':

@terryjreedy
Copy link
Member Author

I will make a separate PR for old specialized methods. There are at least 20 assertEqual(something, None)s that could use 'assertIsNone'. And I found this in test_calltip.py line 334: self.assertIsNone(self.ct.active_calltip, None).

By the 'first one' do you mean the splitting of the condition? It seems that if the conjunction is correct then both separate conditions are correct. The difference is that any error message will be more specific.

@terryjreedy terryjreedy merged commit dbb25ce into python:main Jan 23, 2025
51 checks passed
@miss-islington-app
Copy link

Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2025
Revise 10 tests in 7 files, with 1 test split into 2.
(cherry picked from commit dbb25ce)

Co-authored-by: Terry Jan Reedy <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2025

GH-129237 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 23, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2025
Revise 10 tests in 7 files, with 1 test split into 2.
(cherry picked from commit dbb25ce)

Co-authored-by: Terry Jan Reedy <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2025

GH-129238 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jan 23, 2025
@terryjreedy terryjreedy deleted the new_asserts branch January 23, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants