-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Added version sorting on Web and Removed obsolete versions #52887
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fbb5a37
Added sorting feature and Removed Obsolete sub_versions
Masnan-306 1a5140f
Passed CI Pre-commit check
Masnan-306 d98c1c0
Changed the sorting method with Map
Masnan-306 25a6eb4
Added tests for sorting releases of pandas based on version
Masnan-306 a1eb2a9
Added comment explaining obselete versions
frank-monkey c17f2c9
Integrated sorting into the for loop
frank-monkey 04d89a4
deleted duplicate test
frank-monkey 23f0a8a
Added comments for example of filtering obsolete releases
Masnan-306 a4c6aa2
Combine the two for-loops into one for simplicity
Masnan-306 84f5969
Fixed pre-commit error
Masnan-306 62e9e69
Fixed pre-commit error
Masnan-306 1812b25
Fixed pre-commit error
Masnan-306 2224de4
Merge branch 'main' into WEB_Management
Masnan-306 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [tool.pytest.ini_options] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| from unittest.mock import ( | ||
| MagicMock, | ||
| patch, | ||
| ) | ||
|
|
||
| from web.pandas_web import Preprocessors | ||
|
|
||
|
|
||
| def test_home_add_releases(): | ||
| # Prepare test data | ||
| releases = [ | ||
| { | ||
| "tag_name": "v1.0.0", | ||
| "prerelease": False, | ||
| "published_at": "2021-04-01T00:00:00Z", | ||
| "assets": [{"browser_download_url": "https://example.com/download"}], | ||
| }, | ||
| { | ||
| "tag_name": "v2.0.0", | ||
| "prerelease": False, | ||
| "published_at": "2022-01-01T00:00:00Z", | ||
| "assets": [{"browser_download_url": "https://example.com/download"}], | ||
| }, | ||
| { | ||
| "tag_name": "v1.5.4", | ||
| "prerelease": False, | ||
| "published_at": "2023-08-01T00:00:00Z", | ||
| "assets": [], | ||
| }, | ||
| { | ||
| "tag_name": "v1.5.3", | ||
| "prerelease": False, | ||
| "published_at": "2021-07-01T00:00:00Z", | ||
| "assets": [], | ||
| }, | ||
| { | ||
| "tag_name": "v1.5.2", | ||
| "prerelease": False, | ||
| "published_at": "2021-06-01T00:00:00Z", | ||
| "assets": [], | ||
| }, | ||
| ] | ||
| github_repo_url = "pandas-dev/pandas" | ||
| context = { | ||
| "main": { | ||
| "github_repo_url": github_repo_url, | ||
| "production_url": "https://example.com/", | ||
| }, | ||
| "target_path": "/tmp", | ||
| "releases": [], | ||
| } | ||
|
|
||
| # Mock the requests module to return the test data | ||
| resp = MagicMock() | ||
| resp.status_code = 200 | ||
| resp.json.return_value = releases | ||
| with patch("requests.get", return_value=resp): | ||
| # Call the function being tested | ||
| Preprocessors.home_add_releases(context) | ||
|
|
||
| # Assert that releases were correctly added to the context | ||
| assert len(context["releases"]) == 3 | ||
| assert context["releases"][0]["name"] == "2.0.0" | ||
| assert context["releases"][1]["name"] == "1.5.4" | ||
| assert context["releases"][2]["name"] == "1.0.0" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.