Skip to content

Fix parsing table #35

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 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_stages: [commit]

repos:
- repo: https://github.com/Woile/commitizen
rev: v3.29.0
rev: v3.30.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand All @@ -28,15 +28,15 @@ repos:
stages: [commit, push]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.7.1
hooks:
- id: ruff
args: [--fix, --config=backend/pyproject.toml]
- id: ruff-format
args: [--config=backend/pyproject.toml]

- repo: https://github.com/gitguardian/ggshield
rev: v1.31.0
rev: v1.32.2
hooks:
- id: ggshield
language_version: python3
Expand Down
1 change: 1 addition & 0 deletions backend/caviardeul/services/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
".reference",
".reference-cadre",
".thumb",
".toc",
".wikitable",
"style",
"sup.reference",
Expand Down
27 changes: 21 additions & 6 deletions backend/caviardeul/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from pathlib import Path

import httpx
import pytest
from django.core.cache import cache

Expand All @@ -23,9 +24,16 @@ def inner(
content: str,
):
httpx_mock.add_response(
url=(
"https://fr.wikipedia.org/w/api.php?action=parse&format=json&"
f"page={page_id}&prop=text&formatversion=2&origin=*"
url=httpx.URL(
"https://fr.wikipedia.org/w/api.php",
params={
"action": "parse",
"format": "json",
"prop": "text",
"formatversion": 2,
"origin": "*",
"page": page_id,
},
),
json={"parse": {"title": title, "text": content}},
)
Expand All @@ -37,9 +45,16 @@ def inner(
def mock_wiki_api_error(httpx_mock):
def inner(page_id: str):
httpx_mock.add_response(
url=(
"https://fr.wikipedia.org/w/api.php?action=parse&format=json&"
f"page={page_id}&prop=text&formatversion=2&origin=*"
url=httpx.URL(
"https://fr.wikipedia.org/w/api.php",
params={
"action": "parse",
"format": "json",
"prop": "text",
"formatversion": 2,
"origin": "*",
"page": page_id,
},
),
json={"error": "unknown article"},
)
Expand Down
1 change: 1 addition & 0 deletions backend/caviardeul/tests/views/test_custom_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_get_invalid_custom_article(self, mock_wiki_api_error, client):
assert res.status_code == 400, res.content


@pytest.mark.httpx_mock(can_send_already_matched_responses=True)
class TestCreateCustomArticle:
@pytest.mark.parametrize("authenticated", [True, False])
def test_create_custom_article(self, mock_wiki_api, client, authenticated):
Expand Down
6 changes: 3 additions & 3 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ requires-python = ">=3.11"
dependencies = [
"django ~= 5.0",
"gunicorn ~= 23.0",
"uvicorn ~= 0.30.1",
"uvicorn ~= 0.32.0",
"psycopg[binary] ~= 3.2.1",
"django-ninja ~= 1.3.0",
"httpx ~= 0.27.0",
"cryptography ~= 43.0",
"beautifulsoup4 ~= 4.12.3",
"django-cors-headers ~= 4.4.0",
"redis ~= 5.0.7",
"django-cors-headers ~= 4.5.0",
"redis ~= 5.2.0",
"pydantic ~= 2.9.0",
"sentry-sdk[django]",
"django-import-export>=4.2.0",
Expand Down
455 changes: 233 additions & 222 deletions backend/uv.lock

Large diffs are not rendered by default.

Loading