-
-
Notifications
You must be signed in to change notification settings - Fork 32
Feat/tox python 3.14 #240
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
Feat/tox python 3.14 #240
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
66d12dd
fix: trying some approaches
vinitkumar 83ec1b4
fix: make test setup better
vinitkumar 2e42334
fix: lint
vinitkumar 4ee6454
fix: types and tests
vinitkumar b1d3101
test: Achieve 99% test coverage for dicttoxml module with comprehensi…
vinitkumar 0a6304e
Merge branch 'master' into feat/tox-python-3.14
vinitkumar 54ddb2f
fix: imports
vinitkumar aca64b2
Merge remote-tracking branch 'origin/feat/tox-python-3.14' into feat/…
vinitkumar 04c1619
fix: crash issues
vinitkumar e89aaec
fix: crash issues
vinitkumar 0adfd22
fix: cache crash
vinitkumar f7f9f71
fix: mypy types issue
vinitkumar 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
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
"""Pytest configuration for json2xml tests.""" | ||
from __future__ import annotations | ||
|
||
import json | ||
import os | ||
|
||
from pathlib import Path | ||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union | ||
|
||
|
||
import pytest | ||
|
||
if TYPE_CHECKING: | ||
from _pytest.capture import CaptureFixture | ||
|
||
from _pytest.fixtures import FixtureRequest | ||
|
||
from _pytest.logging import LogCaptureFixture | ||
|
||
from _pytest.monkeypatch import MonkeyPatch | ||
|
||
from pytest_mock.plugin import MockerFixture | ||
|
||
|
||
|
||
@pytest.fixture | ||
def sample_json_string() -> str: | ||
"""Return a sample JSON string for testing. | ||
Returns: | ||
str: A sample JSON string | ||
""" | ||
return '{"login":"mojombo","id":1,"avatar_url":"https://avatars0.githubusercontent.com/u/1?v=4"}' | ||
|
||
|
||
@pytest.fixture | ||
def sample_json_dict() -> Dict[str, Any]: | ||
"""Return a sample JSON dictionary for testing. | ||
Returns: | ||
Dict[str, Any]: A sample JSON dictionary | ||
""" | ||
return { | ||
"login": "mojombo", | ||
"id": 1, | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def sample_json_list() -> List[Dict[str, Any]]: | ||
"""Return a sample JSON list for testing. | ||
Returns: | ||
List[Dict[str, Any]]: A sample list of JSON dictionaries | ||
""" | ||
return [ | ||
{ | ||
"login": "mojombo", | ||
"id": 1, | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | ||
}, | ||
{ | ||
"login": "defunkt", | ||
"id": 2, | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/2?v=4", | ||
}, | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def sample_json_file(tmp_path: Path) -> Path: | ||
"""Create a sample JSON file for testing. | ||
Args: | ||
tmp_path (Path): Pytest temporary path fixture | ||
Returns: | ||
Path: Path to the created JSON file | ||
""" | ||
file_path = tmp_path / "sample.json" | ||
|
||
data = { | ||
"login": "mojombo", | ||
"id": 1, | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/1?v=4", | ||
} | ||
|
||
with open(file_path, "w") as f: | ||
json.dump(data, f) | ||
|
||
return file_path |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The union type for 'val' explicitly lists int and float alongside numbers.Number, which already covers these types. Consider removing the redundant types for clarity, unless the explicitness is needed.
Copilot uses AI. Check for mistakes.