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

Fix jobs/tests/test_models.py misusing assertTrue #1987

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

code-review-doctor
Copy link

Fixes #1986

Copy link

@rbanffy rbanffy 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

@rbanffy rbanffy left a comment

Choose a reason for hiding this comment

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

Sorry. Not a full-time contributor. At least I had an approve button ;-)

@ambv ambv changed the title Some tests misusing assertTrue for comparisons fix Fix jobs/tests/test_models.py misusing assertTrue Mar 11, 2024
Copy link
Contributor

@ambv ambv left a comment

Choose a reason for hiding this comment

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

This is a valid fix, and a straightforward change.

@hugovk
Copy link
Member

hugovk commented Mar 11, 2024

Here's some others, found using https://github.com/isidentical/teyit.

assert_ was removed in 3.12: https://docs.python.org/3/whatsnew/3.12.html#id3

diff --git a/downloads/tests/test_models.py b/downloads/tests/test_models.py
index f27e951..d31afae 100644
--- a/downloads/tests/test_models.py
+++ b/downloads/tests/test_models.py
@@ -82,8 +82,8 @@ class DownloadModelTests(BaseDownloadTests):
 
         release_38 = Release.objects.create(name='Python 3.8.0')
         self.assertFalse(release_38.is_version_at_least_3_9)
-        self.assert_(release_38.is_version_at_least_3_5)
+        self.assertTrue(release_38.is_version_at_least_3_5)
 
         release_310 = Release.objects.create(name='Python 3.10.0')
-        self.assert_(release_310.is_version_at_least_3_9)
-        self.assert_(release_310.is_version_at_least_3_5)
+        self.assertTrue(release_310.is_version_at_least_3_9)
+        self.assertTrue(release_310.is_version_at_least_3_5)

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.

Some tests misusing assertTrue for comparisons
4 participants