Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Jan 16, 2025
1 parent e07ed4f commit 88df2db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
47 changes: 23 additions & 24 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
chardet = "^5.2.0"
httpx = { version = "^0.27.0", extras = ["http2"] }
httpx = { version = "^0.28.1", extras = ["http2"] }

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.1"
pre-commit = "^4.0.0"
ruff = "^0.6.3"
ruff = "^0.9.1"

[tool.ruff]
line-length = 99
Expand Down
18 changes: 16 additions & 2 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
def test_memory_cache():
cache = MemoryCache()
request = Request("GET", "https://httpbin.org/get")
response = Response(ok=True, status=200, reason="OK", url="https://httpbin.org/get", text="")
response = Response(
ok=True,
status=200,
reason="OK",
url="https://httpbin.org/get",
text="",
content=b"",
)

assert not cache.has(request)
assert cache.get(request) is None
Expand All @@ -26,7 +33,14 @@ def test_disk_cache(tmp_path: Path):

assert path.exists()
request = Request("GET", "https://httpbin.org/get")
response = Response(ok=True, status=200, reason="OK", url="https://httpbin.org/get", text="")
response = Response(
ok=True,
status=200,
reason="OK",
url="https://httpbin.org/get",
text="",
content=b"",
)

assert not cache.has(request)
assert cache.get(request) is None
Expand Down

0 comments on commit 88df2db

Please sign in to comment.