Skip to content

Commit 4b4fe59

Browse files
committed
✅ 📝 update tests and docs
1 parent b496bbc commit 4b4fe59

File tree

14 files changed

+81
-40
lines changed

14 files changed

+81
-40
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
22
- repo: https://github.com/ambv/black
3-
rev: 24.4.0
3+
rev: 25.9.0
44
hooks:
55
- id: black
66

77
- repo: https://github.com/pycqa/isort
8-
rev: 5.13.2
8+
rev: 7.0.0
99
hooks:
1010
- id: isort
1111
args: [ "--profile", "black" , "--split-on-trailing-comma", "true"]
@@ -39,7 +39,7 @@ repos:
3939
]
4040

4141
- repo: https://github.com/pre-commit/mirrors-mypy
42-
rev: v1.15.0
42+
rev: v1.18.2
4343
hooks:
4444
- id: mypy
4545
args: []

docs/product/ind/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
India
2+
-----
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:glob:
7+
8+
./*

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ test = [
5555
"pytest-cov~=5.0",
5656
]
5757
docs = [
58-
"sphinx~=5.3",
59-
"sphinx_rtd_theme~=1.1",
60-
"sphinx-autodoc-typehints~=1.20",
58+
"sphinx~=7.3",
59+
"sphinx_rtd_theme~=2.0",
60+
"sphinx-autodoc-typehints~=2.2",
6161
]
6262
build = [
6363
"build",

tests/input/__init__.py

Whitespace-only changes.
File renamed without changes.

tests/v1/input/test_compression.py renamed to tests/input/test_compression.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import operator
22
import os
33
from functools import reduce
4-
from pathlib import Path
54

65
import pytest
76
from PIL import Image
File renamed without changes.
File renamed without changes.

tests/v1/api/test_async_response.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
from pathlib import Path
32

43
import pytest
54
import requests

tests/v1/input/test_local_response.py

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,36 @@
77

88

99
@pytest.fixture
10-
def dummy_secret_key():
11-
return "ogNjY44MhvKPGTtVsI8zG82JqWQa68woYQH"
10+
def file_path() -> Path:
11+
return ASYNC_DIR / "get_completed_empty.json"
1212

1313

14-
@pytest.fixture
15-
def signature():
16-
return "5ed1673e34421217a5dbfcad905ee62261a3dd66c442f3edd19302072bbf70d0"
17-
18-
19-
@pytest.fixture
20-
def file_path():
21-
return Path(ASYNC_DIR / "get_completed_empty.json")
14+
def _assert_local_response(local_response):
15+
fake_hmac_signing = "ogNjY44MhvKPGTtVsI8zG82JqWQa68woYQH"
16+
signature = "5ed1673e34421217a5dbfcad905ee62261a3dd66c442f3edd19302072bbf70d0"
17+
assert local_response._file is not None
18+
assert not local_response.is_valid_hmac_signature(
19+
fake_hmac_signing, "invalid signature"
20+
)
21+
assert signature == local_response.get_hmac_signature(fake_hmac_signing)
22+
assert local_response.is_valid_hmac_signature(fake_hmac_signing, signature)
2223

2324

24-
def test_valid_file_local_response(dummy_secret_key, signature, file_path):
25+
def test_valid_file_local_response(file_path):
2526
with open(file_path, "rb") as file:
2627
local_response = LocalResponse(file)
27-
assert local_response._file is not None
28-
assert not local_response.is_valid_hmac_signature(
29-
dummy_secret_key, "invalid signature"
30-
)
31-
assert signature == local_response.get_hmac_signature(dummy_secret_key)
32-
assert local_response.is_valid_hmac_signature(dummy_secret_key, signature)
28+
_assert_local_response(local_response)
3329

3430

35-
def test_valid_path_local_response(dummy_secret_key, signature, file_path):
31+
def test_valid_path_local_response(file_path):
3632
local_response = LocalResponse(file_path)
3733
assert local_response._file is not None
38-
assert not local_response.is_valid_hmac_signature(
39-
dummy_secret_key, "invalid signature"
40-
)
41-
assert signature == local_response.get_hmac_signature(dummy_secret_key)
42-
assert local_response.is_valid_hmac_signature(dummy_secret_key, signature)
34+
_assert_local_response(local_response)
4335

4436

45-
def test_valid_bytes_local_response(dummy_secret_key, signature, file_path):
37+
def test_valid_bytes_local_response(file_path):
4638
with open(file_path, "r") as f:
4739
str_response = f.read().replace("\r", "").replace("\n", "")
4840
file_bytes = str_response.encode("utf-8")
4941
local_response = LocalResponse(file_bytes)
50-
assert local_response._file is not None
51-
assert not local_response.is_valid_hmac_signature(
52-
dummy_secret_key, "invalid signature"
53-
)
54-
assert signature == local_response.get_hmac_signature(dummy_secret_key)
55-
assert local_response.is_valid_hmac_signature(dummy_secret_key, signature)
42+
_assert_local_response(local_response)

0 commit comments

Comments
 (0)