-
Notifications
You must be signed in to change notification settings - Fork 2
1.8.4 #224
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
Open
digitalghost-dev
wants to merge
14
commits into
main
Choose a base branch
from
1.8.4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+491
−29
Open
1.8.4 #224
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a154237
updating version numbers
digitalghost-dev 46fe506
running gitleaks from docker instead of action
digitalghost-dev 9438f93
reading body into memory before decoding (#223)
digitalghost-dev 9e21c55
increasing timeout (#222)
digitalghost-dev 951ebd6
adding grafana documentation
digitalghost-dev a1dd055
adding lychee link checker for docs
digitalghost-dev 496bfd3
removing single quotes
digitalghost-dev afdb4bc
adding python test (#216)
digitalghost-dev 720214e
increasing test coverage
digitalghost-dev dd6c914
fixing incorrect function name
digitalghost-dev 1b649fa
fixing typos
digitalghost-dev cf40607
adding codecov config file
digitalghost-dev 8d2ed99
moving to root
digitalghost-dev a291efc
adding patch coverage checks
digitalghost-dev 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
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
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| name: 'poke_cli_dbt' | ||
| version: '1.8.3' | ||
| version: '1.8.4' | ||
|
|
||
| profile: 'poke_cli_dbt' | ||
|
|
||
|
|
||
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,168 @@ | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| sys.path.insert(0, str(Path(__file__).parent.parent.parent)) | ||
|
|
||
| import pytest | ||
| import polars as pl | ||
| import responses | ||
| from pipelines.defs.extract.tcgdex.extract_sets import extract_sets_data | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def mock_api_response(): | ||
| """Sample API responses matching tcgdex series format with sets""" | ||
| return { | ||
| "https://api.tcgdex.net/v2/en/series/me": { | ||
| "id": "me", | ||
| "name": "Mega Evolution", | ||
| "sets": [ | ||
| { | ||
| "id": "me01", | ||
| "name": "Mega Evolution", | ||
| "cardCount": {"official": 12, "total": 12}, | ||
| "logo": "https://example.com/me01.png", | ||
| "symbol": "https://example.com/me01-symbol.png", | ||
| }, | ||
| { | ||
| "id": "me02", | ||
| "name": "Phantasmal Flames", | ||
| "cardCount": {"official": 25, "total": 25}, | ||
| "logo": "https://example.com/me02.png", | ||
| "symbol": "https://example.com/me02-symbol.png", | ||
| }, | ||
| ], | ||
| }, | ||
| "https://api.tcgdex.net/v2/en/series/sv": { | ||
| "id": "sv", | ||
| "name": "Scarlet & Violet", | ||
| "sets": [ | ||
| { | ||
| "id": "sv01", | ||
| "name": "Scarlet & Violet", | ||
| "cardCount": {"official": 198, "total": 258}, | ||
| "logo": "https://example.com/sv01.png", | ||
| "symbol": "https://example.com/sv01-symbol.png", | ||
| }, | ||
| { | ||
| "id": "sv02", | ||
| "name": "Paldea Evolved", | ||
| "cardCount": {"official": 193, "total": 279}, | ||
| "logo": "https://example.com/sv02.png", | ||
| "symbol": None, | ||
| }, | ||
| ], | ||
| }, | ||
| "https://api.tcgdex.net/v2/en/series/swsh": { | ||
| "id": "swsh", | ||
| "name": "Sword & Shield", | ||
| "sets": [ | ||
| { | ||
| "id": "swsh1", | ||
| "name": "Sword & Shield", | ||
| "cardCount": {"official": 202, "total": 216}, | ||
| "logo": None, | ||
| "symbol": "https://example.com/swsh1-symbol.png", | ||
| }, | ||
| ], | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| @pytest.mark.benchmark | ||
| @responses.activate | ||
| def test_extract_sets_data_success(mock_api_response): | ||
| """Test successful extraction of sets from multiple series""" | ||
| # Mock all API calls | ||
| for url, response_data in mock_api_response.items(): | ||
| responses.add( | ||
| responses.GET, | ||
| url, | ||
| json=response_data, | ||
| status=200, | ||
| ) | ||
|
|
||
| result = extract_sets_data() | ||
|
|
||
| # Assertions | ||
| assert isinstance(result, pl.DataFrame) # nosec | ||
| assert len(result) == 5 # nosec (2 + 2 + 1 sets) | ||
| assert set(result.columns) == { # nosec | ||
| "series_id", | ||
| "set_id", | ||
| "set_name", | ||
| "official_card_count", | ||
| "total_card_count", | ||
| "logo", | ||
| "symbol", | ||
| } | ||
| assert set(result["series_id"].to_list()) == {"me", "sv", "swsh"} # nosec | ||
| assert set(result["set_id"].to_list()) == {"me01", "me02", "sv01", "sv02", "swsh1"} # nosec | ||
|
|
||
|
|
||
| @pytest.mark.benchmark | ||
| @responses.activate | ||
| def test_extract_sets_data_empty_sets(mock_api_response): | ||
| """Test extraction when a series has no sets""" | ||
| # Modify one response to have empty sets | ||
| mock_api_response["https://api.tcgdex.net/v2/en/series/me"]["sets"] = [] | ||
|
|
||
| for url, response_data in mock_api_response.items(): | ||
| responses.add( | ||
| responses.GET, | ||
| url, | ||
| json=response_data, | ||
| status=200, | ||
| ) | ||
|
|
||
| result = extract_sets_data() | ||
|
|
||
| assert isinstance(result, pl.DataFrame) # nosec | ||
| assert len(result) == 3 # nosec (0 + 2 + 1 sets) | ||
| assert "me" not in result["series_id"].to_list() # nosec | ||
|
|
||
|
|
||
| @pytest.mark.benchmark | ||
| @responses.activate | ||
| def test_extract_sets_data_null_card_counts(): | ||
| """Test extraction with null card counts""" | ||
| mock_responses = { | ||
| "https://api.tcgdex.net/v2/en/series/me": { | ||
| "id": "me", | ||
| "name": "Mega Evolution", | ||
| "sets": [], | ||
| }, | ||
| "https://api.tcgdex.net/v2/en/series/sv": { | ||
| "id": "sv", | ||
| "name": "Scarlet & Violet", | ||
| "sets": [ | ||
| { | ||
| "id": "sv01", | ||
| "name": "Scarlet & Violet", | ||
| "cardCount": {}, | ||
| "logo": None, | ||
| "symbol": None, | ||
| }, | ||
| ], | ||
| }, | ||
| "https://api.tcgdex.net/v2/en/series/swsh": { | ||
| "id": "swsh", | ||
| "name": "Sword & Shield", | ||
| "sets": [], | ||
| }, | ||
| } | ||
|
|
||
| for url, response_data in mock_responses.items(): | ||
| responses.add( | ||
| responses.GET, | ||
| url, | ||
| json=response_data, | ||
| status=200, | ||
| ) | ||
|
|
||
| result = extract_sets_data() | ||
|
|
||
| assert isinstance(result, pl.DataFrame) # nosec | ||
| assert len(result) == 1 # nosec | ||
| assert result["official_card_count"].to_list()[0] is None # nosec | ||
| assert result["total_card_count"].to_list()[0] is None # nosec | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
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.