Skip to content

tests: use sorted(...) instead of .sort() #194

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

Merged
merged 1 commit into from
May 13, 2025
Merged

Conversation

Kakadus
Copy link
Contributor

@Kakadus Kakadus commented May 12, 2025

Pull Request check-list

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

Description of change

While doing #167, I just copied existing tests for the valkey cluster. After reading the test code again, I noticed that the code compares

assert some_list.sort() == other_list.sort()

This is inherently flawed, as .sort() returns None. You can verify that with [0,1].sort() == [1,2].sort().

This PR uses sorted(...) instead which actually returns the sorted list as intended. I also fix one other occurrence of this I found using rg "sort\(\) =="

Copy link
Collaborator

@bogdanp05 bogdanp05 left a comment

Choose a reason for hiding this comment

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

nice catch!
lgtm

@codecov-commenter
Copy link

codecov-commenter commented May 13, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.17%. Comparing base (cf12aae) to head (3bb7ba0).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tests/test_asyncio/test_search.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #194      +/-   ##
==========================================
- Coverage   76.17%   76.17%   -0.01%     
==========================================
  Files         130      130              
  Lines       33983    33983              
==========================================
- Hits        25888    25886       -2     
- Misses       8095     8097       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bogdanp05 bogdanp05 merged commit 70eb871 into valkey-io:main May 13, 2025
85 checks passed
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.

3 participants