Skip to content

Commit 79f98a2

Browse files
committed
Update dev version
* Remove bad type hinting
1 parent 79e95ba commit 79f98a2

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

je_api_testka/httpx_wrapper/async_httpx_method.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import asyncio
22
from datetime import datetime
3-
from typing import Dict, Union, Optional
3+
from typing import Dict, Union
44

55
from httpx import get, put, patch, post, head, delete, Response, AsyncClient
66

@@ -28,7 +28,7 @@
2828
}
2929

3030

31-
async def get_http_method_httpx_async(http_method: str) -> Optional[get, put, patch, post, head, delete]:
31+
async def get_http_method_httpx_async(http_method: str) -> Union[get, put, patch, post, head, delete]:
3232
"""
3333
根據字串取得對應的 HTTP 方法,若不存在則拋出例外
3434
Get corresponding HTTP method from string, raise exception if not exists
@@ -109,7 +109,7 @@ async def test_api_method_httpx_async(
109109
timeout: int = 5,
110110
http2: bool = False,
111111
**kwargs,
112-
) -> Optional[Response, Dict[str, str]]:
112+
) -> dict[str, Response | dict[str, str]] | None:
113113
"""
114114
測試 API 方法,記錄請求與回應,並可進行結果檢查
115115
Test API method, record request/response, and optionally check result
@@ -167,7 +167,7 @@ def delegate_async_httpx(
167167
result_check_dict: dict = None,
168168
timeout: int = 5,
169169
**kwargs,
170-
) -> Optional[Response, Dict[str, str]]:
170+
) -> dict[str, Response | dict[str, str]] | None:
171171
"""
172172
同步呼叫非同步 API 測試方法,方便在非 async 環境使用
173173
Run async API test method synchronously, useful in non-async environments

je_api_testka/httpx_wrapper/httpx_method.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
from datetime import datetime
2-
from typing import Dict, Optional, Union
2+
from typing import Dict, Union
33

44
from httpx import get, put, patch, post, head, delete, options, Response
55

66
from je_api_testka.httpx_wrapper.httpx_data import get_httpx_data
77
from je_api_testka.utils.assert_result.result_check import check_result
8-
from je_api_testka.utils.test_record.test_record_class import test_record_instance
9-
108
from je_api_testka.utils.exception.exception_tags import (
119
get_data_error_message,
1210
wrong_http_method_error_message,
1311
http_method_have_wrong_type,
1412
)
1513
from je_api_testka.utils.exception.exceptions import APITesterGetDataException, APITesterException
1614
from je_api_testka.utils.logging.loggin_instance import apitestka_logger
15+
from je_api_testka.utils.test_record.test_record_class import test_record_instance
1716

1817
# 定義 HTTP 方法字典,對應到 httpx 的方法
1918
# Define HTTP method dictionary mapping to httpx methods
@@ -28,7 +27,7 @@
2827
}
2928

3029

31-
def get_http_method_httpx(http_method: str) -> Optional[get, put, patch, post, head, delete]:
30+
def get_http_method_httpx(http_method: str) -> Union[get, put, patch, post, head, delete]:
3231
"""
3332
根據字串取得對應的 HTTP 方法,若不存在則拋出例外
3433
Get corresponding HTTP method from string, raise exception if not exists
@@ -104,7 +103,7 @@ def send_httpx_requests(http_method: str, test_url: str, verify: bool = False, t
104103
def test_api_method_httpx(http_method: str, test_url: str, record_request_info: bool = True,
105104
clean_record: bool = False, result_check_dict: dict = None,
106105
verify: bool = False, timeout: int = 5,
107-
**kwargs) -> Optional[Response, Dict[str, str]]:
106+
**kwargs) -> dict[str, Response | dict[str, str]] | None:
108107
"""
109108
測試 API 方法,記錄請求與回應,並可進行結果檢查
110109
Test API method, record request/response, and optionally check result

je_api_testka/requests_wrapper/request_method.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from datetime import datetime
2-
from typing import Dict, Union, Optional
2+
from typing import Dict, Union
33

44
import requests
5-
from requests import Session
5+
from requests import Session, Response
66
from requests import delete, get, head, options, patch, post, put
77
from requests.structures import CaseInsensitiveDict
88

9+
from je_api_testka.requests_wrapper.requests_data import get_requests_data
910
from je_api_testka.utils.assert_result.result_check import check_result
1011
from je_api_testka.utils.exception.exception_tags import (
1112
get_data_error_message,
1213
http_method_have_wrong_type,
1314
wrong_http_method_error_message,
1415
)
1516
from je_api_testka.utils.exception.exceptions import APITesterException, APITesterGetDataException
16-
from je_api_testka.requests_wrapper.requests_data import get_requests_data
1717
from je_api_testka.utils.logging.loggin_instance import apitestka_logger
1818
from je_api_testka.utils.test_record.test_record_class import test_record_instance
1919

@@ -114,7 +114,7 @@ def test_api_method_requests(http_method: str, test_url: str,
114114
soap: bool = False, record_request_info: bool = True,
115115
clean_record: bool = False, result_check_dict: dict = None,
116116
verify: bool = False, timeout: int = 5, allow_redirects: bool = False,
117-
**kwargs) -> Optional[requests.Response, Dict[str, str]]:
117+
**kwargs) -> None | Response | dict[str, str] | dict[str, Response | dict[str, str]]:
118118
"""
119119
測試 API 方法,記錄請求與回應,並可進行結果檢查
120120
Test API method, record request/response, and optionally check result

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "je_api_testka_dev"
9-
version = "0.0.127"
9+
version = "0.0.128"
1010
authors = [
1111
{ name = "JE-Chen", email = "[email protected]" },
1212
]

0 commit comments

Comments
 (0)