text stringlengths 3 8.33k | repo stringclasses 52
values | path stringlengths 6 141 | language stringclasses 35
values | sha stringlengths 64 64 | chunk_index int32 0 273 | n_tokens int32 1 896 |
|---|---|---|---|---|---|---|
source_dir.mkdir()
manifest = source_dir / "fetch_done.jsonl"
manifest.write_bytes(
b'{"item_id":"a","ts":"2026-03-01"}\nnot json\n{"item_id":"b","ts":"2026-03-02"}\n'
)
result = _read_manifest_stats(tmp_path, "test_source", "fetch")
assert result["count"] == 2 # skips corrupt line
asse... | jku-encyclopedia | tests/unit/test_cli.py | Python | 959f17f8b88adc17305b06e01074b472802a5d235314e4f22fa9fd452530bc65 | 13 | 896 |
in records:
f.write(orjson.dumps(r) + b"\n")
result = _count_source_modalities(tmp_path, "test_src")
assert result == {"text": 2, "image": 1}
def test_count_source_modalities_missing_file(tmp_path):
"""_count_source_modalities returns empty dict if file does not exist."""
from jku_kb.cli.... | jku-encyclopedia | tests/unit/test_cli.py | Python | 83d8dc4aa7300ab69737147f68e503c8b796ef91c045fd71f9e99f131436890c | 14 | 896 |
per source and cross_modal_edges."""
import json
import orjson
from unittest.mock import AsyncMock, MagicMock, patch
from typer.testing import CliRunner
from jku_kb.cli import app
from jku_kb.models import HealthResult, SourceEntry, SourceQuality
runner = CliRunner()
# Create fixtur... | jku-encyclopedia | tests/unit/test_cli.py | Python | 98f6d7be2a62cdcf110c43aa87a125637e543366df32cd0c8bf63407cda1ab32 | 15 | 896 |
21, Plan 02)
# ---------------------------------------------------------------------------
def test_dashboard_modality_callback():
"""modality_callback updates _RowState.modality_counts correctly."""
from jku_kb.cli.dashboard import LiveDashboard
from rich.console import Console
dashboard = LiveDashb... | jku-encyclopedia | tests/unit/test_cli.py | Python | 607f0e98b941a21787a2901411ae1121bd04b93a126ebebbd0b87b4c2d3fe934 | 16 | 675 |
"""Unit tests for configuration loading and validation."""
from __future__ import annotations
from pathlib import Path
import pytest
import structlog.testing
from pydantic import ValidationError
from jku_kb.config import Settings, CrawlVariantConfig, get_settings, warn_if_missing_keys
@pytest.fixture()
def _clean... | jku-encyclopedia | tests/unit/test_config.py | Python | 70fd7de5079dd9598bd8cf8de08fd93e68a3910e1da8129ae8fa6161eea70895 | 0 | 896 |
test_taxonomy_path(self):
s = Settings(_env_file=None, data_dir=Path("/tmp/test_data"))
assert s.taxonomy_path == Path("/tmp/test_data/taxonomy.json")
def test_seed_edges_path(self):
s = Settings(_env_file=None, data_dir=Path("/tmp/test_data"))
assert s.seed_edges_path == Path("/tmp... | jku-encyclopedia | tests/unit/test_config.py | Python | f647410964b850190d02f0ef25a077be76d2c40991d77e2abeaf4a8fd52017d0 | 1 | 896 |
at/"], crawl_mode="invalid")
def test_existing_variants_have_recursive_default(self):
"""All 2 institute source_variants inherit crawl_mode='recursive'."""
s = Settings()
for name in ("bioinf_jku", "fmv_jku"):
assert s.source_variants[name].crawl_mode == "recursive", f"{name} sh... | jku-encyclopedia | tests/unit/test_config.py | Python | 55650d389e91082dcb4a308f3478b8ccde1c73e9093b7b96c343fe5c46c9e4f3 | 2 | 101 |
"""Unit tests for deduplication engine."""
from __future__ import annotations
import datetime
from jku_kb.models import RawItem
from jku_kb.storage.dedup import DeduplicationEngine, write_dedup_decision
def _make_item(
item_id: str,
title: str = "Test Paper",
author: str = "Author A",
year: int | N... | jku-encyclopedia | tests/unit/test_dedup.py | Python | 2d5339c050e66aed2b6973f6c5c70b15278b6a97ed8265496ba0c8173e465403 | 0 | 896 |
1
assert stats["title_entries"] == 1
class TestAuditJSONL:
def test_write_dedup_decision_creates_file(self, tmp_path):
"""write_dedup_decision creates the audit JSONL file with required fields."""
import orjson
item = _make_item("item_2", doi="10.1234/test", source_id="source_a")
... | jku-encyclopedia | tests/unit/test_dedup.py | Python | a86bd40a4a0d85c5b4d8946e16f388cf6a765096af357b24ec876b3533f98d43 | 1 | 672 |
"""Unit tests for structured logging setup."""
from __future__ import annotations
import json
import logging
from io import StringIO
import structlog
import structlog.testing
from jku_kb.logging import get_logger, setup_logging
class TestSetupLoggingJsonFormat:
"""Test that setup_logging produces valid JSON o... | jku-encyclopedia | tests/unit/test_logging.py | Python | 7d302f2593f2f3f853ad69b89a94c5c05a5ef1aebeda9419bfa9316c14d42b3f | 0 | 896 |
("plain")
log.info("plain_event")
entry = cap[-1]
assert entry["event"] == "plain_event"
assert "source_id" not in entry
def test_context_persists_across_calls(self):
"""Bound context should persist across multiple log calls on the same logger."""
with structlog.... | jku-encyclopedia | tests/unit/test_logging.py | Python | f3f70c6bf3821226378a00f9f032c1a7167146c8817207c906bf658401bb27d2 | 1 | 681 |
"""Unit tests for ManifestWriter buffered JSONL writer."""
from __future__ import annotations
from pathlib import Path
import orjson
import pytest
from jku_kb.orchestrator.helpers import ManifestWriter
def test_manifest_writer_buffers_until_threshold(tmp_path: Path):
p = tmp_path / "done.jsonl"
with Manife... | jku-encyclopedia | tests/unit/test_manifest_writer.py | Python | d0861c13cd1c16d02b7c7b174b964ba3cfef1592c6c426014373f9dcb4b7a563 | 0 | 465 |
"""Unit tests for data models."""
from __future__ import annotations
from jku_kb.models import (
Chunk,
ChunkStatus,
Edge,
EdgeType,
EmbeddingResult,
EmbedStatus,
FetchResult,
FetchStatus,
ManifestEntry,
Modality,
RawItem,
StructuralEdgeType,
)
class TestModality:
... | jku-encyclopedia | tests/unit/test_models.py | Python | cd657df51e25c8dd11a8bc1cb501e0e1cc2438fb8dd4e993c91869cafcefdd29 | 0 | 805 |
"""Unit tests for orchestrator phase manifest helpers and pipeline orchestration."""
from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import orjson
import pytest
from jku_kb.models import Modality
from jku_kb.orchestrator import (
ManifestWriter,
... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 387673cc89e2a2aafc320eea4c9b99b97e4afa83b128da4acd3aea6126e11863 | 0 | 896 |
()
# ---------------------------------------------------------------------------
# run_phase_chunk resumability
# ---------------------------------------------------------------------------
@pytest.fixture()
def settings(tmp_path: Path) -> MagicMock:
"""Minimal settings mock with cache_dir pointing to tmp_path.... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 7aabfb2c03130294436f25f2c6abd725e4206307fd23908c41d1552c30677004 | 1 | 896 |
= source_dir / "chunks"
from jku_kb.models import Chunk, Modality
fake_chunk = Chunk(
chunk_id="chunk-1",
source_id=source_id,
item_id="item-1",
modality=Modality.TEXT,
chunk_index=0,
chunk_total=1,
title="Test",
)
mock_chunker_instance = AsyncMo... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 09c8b19ef13e6e8ee101c24d69a9dd4ed5b8b17fae6c8d5d05de86c00707177c | 2 | 896 |
-------------
# run_all phases order
# ---------------------------------------------------------------------------
@pytest.mark.asyncio
async def test_run_all_phases_in_order(orchestrator: PipelineOrchestrator) -> None:
"""run_all calls all 5 phases in order: discover, fetch, chunk, embed, link."""
call_order... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | b8d15d3ce836184e46b1ed3be295c7b835a49e8571d8301d3b12858491cc9089 | 3 | 896 |
(progress_callback=callback)
for phase, cb in captured_callbacks.items():
assert cb is callback, f"Phase {phase!r} did not receive progress_callback"
# ---------------------------------------------------------------------------
# run_phase_link mode filtering
# -------------------------------------------... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 627f51f58e25956863f69e8b4322094e30d8055156f4ecb999f8b3cffb5e037b | 4 | 896 |
--------------------------------------------
# get_scraper / _guess_modality / all_source_ids
# ---------------------------------------------------------------------------
def test_get_scraper_known_source(settings: MagicMock) -> None:
"""get_scraper returns a scraper for a known source_id."""
from jku_kb.con... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 4585adfdcb1e81b0752669334bd0f797135dcf4838d87f0717e23174c338854d | 5 | 896 |
: PipelineOrchestrator,
) -> None:
"""Discover returns item counts per source."""
from jku_kb.models import RawItem
items = [
RawItem(item_id="i1", source_id="github_jku", url="https://example.com/1"),
RawItem(item_id="i2", source_id="github_jku", url="https://example.com/2"),
]
fa... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 2806daeef1251b996f3d418599d1df60f9d661e3742b98cfbab981df3d688381 | 6 | 896 |
.FETCHED),
FetchResult(item_id="i3", source_id="s1", fetch_status=FetchStatus.FAILED),
]
fake_scraper = AsyncMock()
fake_scraper.run = AsyncMock(return_value=fetch_results)
fake_scraper.__aenter__ = AsyncMock(return_value=fake_scraper)
fake_scraper.__aexit__ = AsyncMock(return_value=False)
... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | c1ffeb563c388821d2d958dcb4d37b26f3c986e46ce3db9b3ecb94c762262d2e | 7 | 896 |
-2.txt"
file2.write_text("content 2")
_write_source_manifest(
tmp_path,
source_id,
[
{"item_id": "item-1", "local_path": str(file1)},
{"item_id": "item-2", "local_path": str(file2)},
],
)
from jku_kb.models import Chunk
good_chunk = Chunk(
... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 91cf29647ca2fe834a0820d77cd0054d44b443d2f41a7638aa4e45efe55eb96f | 8 | 896 |
.embed_chunks = _fake_embed_chunks
mock_qdrant_cls = MagicMock()
mock_neo4j_cls = MagicMock()
mock_qdrant = AsyncMock()
mock_neo4j = AsyncMock()
mock_qdrant_cls.return_value.__aenter__ = AsyncMock(return_value=mock_qdrant)
mock_qdrant_cls.return_value.__aexit__ = AsyncMock(return_value=False)
... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | decdfe3e5c6a558674c8156964e19b3479b5af9b49d83772aa64a6597db9c2e3 | 9 | 896 |
as mock_next,
):
mock_tax = AsyncMock()
mock_tax.assign_all_chunks = AsyncMock(return_value=15)
mock_tax_cls.return_value = mock_tax
results = await orchestrator.run_phase_link(mode="taxonomy")
assert results["taxonomy"] == 15
assert "seed_edges" not in ... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | 4d23a2cbae3951c91c2ef5e75832f99560039693747ca0be79707026b297b09f | 10 | 896 |
-------------------------------------------------------
# get_status
# ---------------------------------------------------------------------------
@pytest.mark.asyncio
async def test_get_status_no_manifests(
orchestrator: PipelineOrchestrator,
tmp_path: Path,
) -> None:
"""get_status returns zeros when no... | jku-encyclopedia | tests/unit/test_orchestrator.py | Python | e11f52b2be48d9bb6d8c92f79a180a875645630c9693f7a09f509f2cddf40c2e | 11 | 486 |
"""Unit tests for concurrency probe utility."""
from __future__ import annotations
import asyncio
import httpx
import pytest
import respx
from jku_kb.probe import probe_concurrency
class TestProbeLogic:
"""Unit tests for probe_concurrency with mocked HTTP."""
@pytest.mark.asyncio
async def test_probe... | jku-encyclopedia | tests/unit/test_probe.py | Python | 621f083f72cea2b3c226467625b792de366f96e320d103cc3a9d2a08bd5ca656 | 0 | 854 |
"""Unit tests for quality gate infrastructure: health probes, content validation, thresholds."""
from __future__ import annotations
from pathlib import Path
import httpx
import pytest
import respx
from httpx import Response
from jku_kb.models import HealthResult, RawItem, SourceEntry, SourceQuality
from jku_kb.quali... | jku-encyclopedia | tests/unit/test_quality.py | Python | 44dd9994b201662bdd931322eeab54d5b4b59fa4c6ceb565fbe449a4b85c3fa3 | 0 | 896 |
'{"source_id": "valid_src", "name": "Valid", "category": "api", "url": "https://valid.com"}'
']}',
encoding="utf-8",
)
entries = load_source_entries(sources_json)
assert len(entries) == 1
assert entries[0].source_id == "valid_src"
def test_all_entries_have_qu... | jku-encyclopedia | tests/unit/test_quality.py | Python | 67ae18ed7e50189bde36a650dc7befb0e658e7e8474dcea6e86d5f75b499d2fe | 1 | 896 |
"source_id": "src_a",
"name": "A",
"category": "api",
"url": "https://a.example.com",
"quality": {"health_url": "https://a.example.com/health"},
}),
SourceEntry.model_validate({
"source_id": "src_b",
... | jku-encyclopedia | tests/unit/test_quality.py | Python | 4cccf14fe45f293e366b410173a6f44851c514e465f623ad3325a62a93809fbc | 2 | 896 |
[
RawItem(
item_id=f"bad_{i}",
source_id="test_source",
url=f"https://test.example.com/bad/{i}",
title="x",
description="y",
)
for i in range(5)
]
items = good_items + bad_items
w... | jku-encyclopedia | tests/unit/test_quality.py | Python | f180d9c5d7a3218cd18b2322ef822c96da916965708b9308e978dd97538a6f47 | 3 | 354 |
"""Unit tests for scraper registry."""
from __future__ import annotations
import pytest
from jku_kb.config import Settings
from jku_kb.scrapers import _REGISTRY, get_scraper, validate_registry
@pytest.fixture
def settings() -> Settings:
return Settings()
def test_register_scraper_populates_registry():
"""... | jku-encyclopedia | tests/unit/test_registry.py | Python | ab906a9572edd09a3657708e7daaab8f5088352d09279c15fb84829528cbe70e | 0 | 326 |
"""Verify Wayback scraper is fully removed (SRC-01)."""
from __future__ import annotations
import pytest
def test_wayback_import_raises():
"""Importing WaybackScraper must raise ImportError — module is deleted."""
with pytest.raises(ImportError):
from jku_kb.scrapers.wayback import WaybackScraper # ... | jku-encyclopedia | tests/unit/test_wayback_removed.py | Python | 694cc25d1ab02d2456f1606c62df276daa33bbb491b82c325b7cda630c70bb41 | 0 | 155 |
"""Unit tests for BatchEmbedder dual-store callback with split-failure handling.
Tests cover:
- embed_chunks calls embed_chunk per item with semaphore concurrency control
- on_result callback invoked for each result (including FAILED)
- make_dual_store_callback wires Qdrant and Neo4j in parallel
- Callback skips FAILE... | jku-encyclopedia | tests/unit/test_embedders/test_batch.py | Python | 013c2ebabb258890b347c66a0d2ca04e50282f003224f3dd14a1c809d6fe7365 | 0 | 896 |
Path:
root = tmp_path / "dead_letters"
root.mkdir(parents=True, exist_ok=True)
return root
# ---------------------------------------------------------------------------
# BatchEmbedder core tests
# ---------------------------------------------------------------------------
@pytest.mark.asyncio
async def... | jku-encyclopedia | tests/unit/test_embedders/test_batch.py | Python | 9ed173f6a0c98cfa75a5232187418d5253af8a8b4b785be0157ad008d397fcc7 | 1 | 896 |
(mock_qdrant, mock_neo4j, dead_letter_root)
chunk = _make_chunk("c1", source_id="src_a")
result = _make_result("c1", EmbedStatus.EMBEDDED)
await callback(chunk, result)
mock_qdrant.upsert.assert_called_once_with(chunk, result)
mock_neo4j.upsert_chunk_node.assert_called_once_with(chunk)
@pytest.m... | jku-encyclopedia | tests/unit/test_embedders/test_batch.py | Python | 87dda32c6cd3eb31ea94c9b1e9ec83308cb20188023d7de21ff865c87c2fe7a0 | 2 | 896 |
.batch import _dead_letter_path_for_source
path = _dead_letter_path_for_source(dead_letter_root, "my_source")
assert path == dead_letter_root / "my_source" / "dead_letter.jsonl"
# Directory should be created by the helper
assert path.parent.exists()
@pytest.mark.asyncio
async def test_callback_skips_... | jku-encyclopedia | tests/unit/test_embedders/test_batch.py | Python | 041edf20be64911461b1c695dcd8207d9e30d1b9e29faa8edc06d72ae4529b7c | 3 | 427 |
"""Unit tests for GeminiEmbedder hardening.
Tests cover:
- asyncio.to_thread wrapping of all sync SDK calls
- tenacity retry on 429/5xx errors, no retry on 400
- startup_sweep() orphan file cleanup
- probe_all_dimensions() per-modality dimension probing
- connect() fails fast on probe failure
- Video/audio poll loop t... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 9e49923fda0c3f62f759cf56d1131327560b12d0840895b1fedd1a3d6e11e8ca | 0 | 896 |
(
chunk_id="c3",
source_id="s1",
item_id="i3",
modality=Modality.VIDEO,
local_path=str(mp4_path),
chunk_index=0,
chunk_total=1,
)
# ---------------------------------------------------------------------------
# Tests
# ----------------------------------------... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | ac056056d2e44f4415009cfdb3d0faa35b708b50a41706cbecaff4aadc2b8482 | 1 | 896 |
eventually succeed."""
error_429 = _http_error(429)
success_response = _make_embed_response(3072)
call_count = {"n": 0}
async def fake_to_thread(fn, *args, **kwargs):
call_count["n"] += 1
if call_count["n"] <= 2:
raise error_429
retur... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 82c26ba952a054dcfa109abea4f677945fd6fd1b35b94ec6a9b5e6e4532ee9b1 | 2 | 896 |
invoke all 5 modality embed paths and return 6 entries."""
dim_result = EmbeddingResult(chunk_id="probe", vector=[0.1] * 3072, dimension=3072, model="test")
with (
patch.object(embedder, "_build_probe_chunks", return_value=_make_probe_chunks()),
patch.object(embedder, "embed_tex... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 8bf69fb4c0cf0c05f6b887be9aeed863ae84fa679d7bdf06a2013246ba44ef01 | 3 | 896 |
"
with patch("asyncio.to_thread", new_callable=AsyncMock) as mock_tt:
mock_tt.return_value = _make_embed_response(3072)
result = await embedder.embed_chunk(text_chunk)
assert result.embed_status == EmbedStatus.EMBEDDED
assert result.chunk_id == "c1"
@pytest.mark.asyn... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | cf0570bc3d86075fbdbd1fb8fbe90a31fc12037d0fc370ceac4a502b7104225c | 4 | 896 |
audio_path),
chunk_index=0,
chunk_total=1,
)
file_ref = MagicMock()
file_ref.name = "files/test-aud"
file_ref.state = None # Immediately active
async def fake_to_thread(fn, *args, **kwargs):
if fn is embedder._client.files.upload:
... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | bbf693fdcdb9644f4ab4696f2d76500e9fcb1dba9a553fa8a5caca573638cc2e | 5 | 896 |
------------------------------
# embed_image_chunk / embed_audio_chunk missing local_path
# ---------------------------------------------------------------------------
class TestMissingLocalPath:
@pytest.mark.asyncio
async def test_image_no_local_path_raises(self, embedder: GeminiEmbedder) -> None:
""... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 9769ec2294c1fef7a8f26c0f0c92146420a3c09f63f3f6407702bcbfad358a65 | 6 | 896 |
None:
"""startup_sweep() handles empty file list."""
async def fake_to_thread(fn, *args, **kwargs):
if fn is mock_genai_client.files.list:
return []
return None
with patch("asyncio.to_thread", side_effect=fake_to_thread):
deleted = await embed... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 27b534151759e8c1d14203d83a91329b551aaccf2a96bc557be28ea3493e886f | 7 | 896 |
embedders.gemini.genai") as mock_genai,
patch.object(embedder, "startup_sweep", new_callable=AsyncMock, return_value=0),
patch.object(
embedder,
"probe_all_dimensions",
new_callable=AsyncMock,
return_value={Modality.TEXT: 3072},
... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 66a0f36e5b62fa964925cc0066e9fe00e8013a6f71b52e6f27729865ed6107e1 | 8 | 896 |
("test.webm")) == "video/webm"
def test_unknown_extension(self) -> None:
"""_guess_mime returns application/octet-stream for unknown extension."""
from jku_kb.embedders.gemini import _guess_mime
assert _guess_mime(Path("test.xyz")) == "application/octet-stream"
# ------------------------... | jku-encyclopedia | tests/unit/test_embedders/test_gemini.py | Python | 1a98313cca47fe452f779a6c4e27de0427cccca21fa8117c399b90690d1809c6 | 9 | 719 |
"""Unit tests for graph NEXT_CHUNK edge builder."""
from __future__ import annotations
from unittest.mock import AsyncMock, MagicMock
import pytest
from jku_kb.graph.next_chunk import build_next_chunk_edges
class AsyncResultMock:
"""Async iterable mock for Neo4j session.run() results."""
def __init__(sel... | jku-encyclopedia | tests/unit/test_graph/test_next_chunk.py | Python | 4eb4d90301316554c00c54ea3ccc5950b29250bedd097eef381f78d376fa76a6 | 0 | 896 |
records)
result = await build_next_chunk_edges(store)
# 2 edges from (item_a, src_x) + 1 edge from (item_a, src_y) = 3 total
assert result == 3
assert store.create_next_chunk_edges.call_count == 2
@pytest.mark.asyncio
async def test_build_next_chunk_edges_orders_by_chunk_index... | jku-encyclopedia | tests/unit/test_graph/test_next_chunk.py | Python | a650abcacb46e69b29e6ce3a305fcfcbd99c4f8eee7b22b5579bc8bf8a55f41b | 1 | 305 |
"""Unit tests for graph seed edges module."""
from __future__ import annotations
import json
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
import pytest
from jku_kb.graph.seed_edges import insert_seed_edges, load_seed_edges
class TestLoadSeedEdges:
def test_load_seed_edges_returns_ed... | jku-encyclopedia | tests/unit/test_graph/test_seed_edges.py | Python | 106a4a723237873af439a34a3aaa3adab5340d2a29ccdeca2db94db9ee1c2d4d | 0 | 896 |
pytest.mark.asyncio
async def test_skip_empty_ids(self) -> None:
"""insert_seed_edges skips edges with missing source_id or target_id."""
store = self._make_store()
edges = [
{"source_id": "", "target_id": "src_b", "edge_type": "IMPLEMENTS", "confidence": 1.0},
{"sour... | jku-encyclopedia | tests/unit/test_graph/test_seed_edges.py | Python | efc3cca94b04c2d1cfcef30aa00ff94008450c6ef4028435017c9f51b076c1df | 1 | 325 |
"""Unit tests for the similarity engine and QdrantStore.search_similar_with_modality."""
from __future__ import annotations
import json
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
import pytest
from qdrant_client import AsyncQdrantClient
from jku_kb.config import Settings
from jku_kb.gra... | jku-encyclopedia | tests/unit/test_graph/test_similarity.py | Python | ce0ff8388c9244eb88f57c74e09bfc3835a37609b5b07619e8f200313464a837 | 0 | 896 |
Qdrant results return empty list."""
mock_qdrant_client.query_points.return_value = MagicMock(points=[])
results = await qdrant_store.search_similar_with_modality(
vector=[0.1] * 10,
top_k=5,
threshold=0.75,
)
assert results == []
@pytest.mark.a... | jku-encyclopedia | tests/unit/test_graph/test_similarity.py | Python | 816535f38da1155f4f6902ce06f6e7d8535c6f5cd94e49c05dd1ec360c02ebbf | 1 | 896 |
/ "ck.json"
_save_checkpoint(path, "some-offset")
assert path.exists()
_clear_checkpoint(path)
assert not path.exists()
def test_clear_checkpoint_ok_when_missing(self, tmp_path: Path) -> None:
path = tmp_path / "nonexistent.json"
_clear_checkpoint(path) # should not... | jku-encyclopedia | tests/unit/test_graph/test_similarity.py | Python | d197e65e8ddfde0d428e9ba0ab72e7124d045139989e09132e7b665535edafee | 2 | 896 |
}, score=0.9)]
)
await compute_similarity_backlinks(
qdrant=qdrant_store,
neo4j=mock_neo4j,
settings=settings,
checkpoint_path=tmp_path / "ck.json",
)
edges = mock_neo4j.create_similarity_edges_batch.call_args[0][0]
cross_modal_fl... | jku-encyclopedia | tests/unit/test_graph/test_similarity.py | Python | fba2268953290aa781c22c25b7cc4eef78146eba62f9a7cf98404833db6fe900 | 3 | 896 |
", [0.1] * 10)
mock_qdrant_client.scroll.side_effect = [
([pt], None),
]
mock_qdrant_client.query_points.return_value = MagicMock(
points=[MagicMock(payload={"chunk_id": "c2", "modality": "text"}, score=0.9)]
)
ck_path = tmp_path / "ck.json"
await... | jku-encyclopedia | tests/unit/test_graph/test_similarity.py | Python | a63409c319e9ae07714ef38f8ffad71d83c0037f8e7d9b483d74333c9ac2921f | 4 | 281 |
"""Unit tests for graph taxonomy module."""
from __future__ import annotations
import json
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
import pytest
from jku_kb.graph.taxonomy import TaxonomyAssigner
from jku_kb.models import Chunk, Modality
TAXONOMY_FIXTURE = {
"topics": [
... | jku-encyclopedia | tests/unit/test_graph/test_taxonomy.py | Python | 6fe288336a04425ebcaf5a6f24263add385b4d28bb8c5f2f651a95c8d5c5bab9 | 0 | 896 |
assigner.assign_topics(chunk)
assert "deep_learning" in topics
assert "music_ir" in topics
class TestAssignAllChunks:
@pytest.mark.asyncio
async def test_assign_all_chunks_creates_topic_nodes(self, tmp_path: Path) -> None:
"""assign_all_chunks calls create_topic_node for each topic in ... | jku-encyclopedia | tests/unit/test_graph/test_taxonomy.py | Python | a8002b6bd3b881630248f9b5b57ee0e89b3ed15987d9b0188611ecf70bb50ea0 | 1 | 432 |
"""Unit tests for graph visualization export module."""
from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock
import pytest
from jku_kb.graph.visualization import export_graphml
class AsyncResultMock:
"""Async iterable mock for Neo4j session.run() results."... | jku-encyclopedia | tests/unit/test_graph/test_visualization.py | Python | baeb036b53c79a3a8c0e24d9c133cdb26054e905f763f06e5b9cb5fd6f0294e5 | 0 | 896 |
assert "code" in content
@pytest.mark.asyncio
async def test_export_graphml_returns_total_count(self, tmp_path: Path) -> None:
"""export_graphml returns node_count + edge_count."""
chunk_records = [
{
"c.chunk_id": "chunk-001",
"c.modality": "text",
... | jku-encyclopedia | tests/unit/test_graph/test_visualization.py | Python | d8dbf332bddee40641fa536378da2189b0c6f6595af29b1bbfca9a7b00b4697d | 1 | 213 |
"""Unit tests for arXiv scraper."""
from __future__ import annotations
import json
from pathlib import Path
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.scrapers.arxiv import ArxivScraper, _entry_to_raw_item, _parse_atom_feed
ATOM_NS = "http://www.w3.org/2005... | jku-encyclopedia | tests/unit/test_scrapers/test_arxiv.py | Python | 44ef913a2776e9267b9fe23a19e0f53a9248760af521125873a750439cfd6e3f | 0 | 896 |
href="http://arxiv.org/pdf/{arxiv_id}v1" rel="related" type="application/pdf"/>
<category term="cs.LG" scheme="http://arxiv.org/schemas/atom"/>
</entry>""")
entries_xml = "\n".join(entry_xmls)
return f'<?xml version="1.0" encoding="UTF-8"?>\n<feed xmlns="{ATOM_NS}">\n{entries_xml}\n</feed>'
def _write_x... | jku-encyclopedia | tests/unit/test_scrapers/test_arxiv.py | Python | 6cfe47ac1d9d679a31231e33fa656d602d9800bd303650e6628ffdb7e2661f46 | 1 | 896 |
returns RawItems from a single-page Atom feed."""
call_count = 0
def side_effect(request):
nonlocal call_count
call_count += 1
if call_count == 1:
return Response(200, text=ARXIV_ATOM_FIXTURE, headers={"Content-Type": "application/atom+xml"})
... | jku-encyclopedia | tests/unit/test_scrapers/test_arxiv.py | Python | 8c0d11e2d31d8c88251f26f461a940cc271f2e0a68193a0756b0abc9d942cf70 | 2 | 896 |
-Type": "application/atom+xml"})
call_counts["text"] += 1
if call_counts["text"] == 1:
return Response(200, text=text_feed, headers={"Content-Type": "application/atom+xml"})
return Response(200, text=ARXIV_ATOM_EMPTY, headers={"Content-Type": "application/atom+xml"})
... | jku-encyclopedia | tests/unit/test_scrapers/test_arxiv.py | Python | 2b24f1649ae99a9be84d77f57eabdd866e15b0766c1e51ce4fbc2e21ab7cb5f0 | 3 | 611 |
"""Unit tests for BaseScraper dedup integration."""
from __future__ import annotations
import asyncio
from typing import Any
import httpx
import orjson
import pytest
from jku_kb.config import Settings
from jku_kb.models import FetchResult, FetchStatus, RawItem
from jku_kb.scrapers.base import BaseScraper
from jku_k... | jku-encyclopedia | tests/unit/test_scrapers/test_base_scraper.py | Python | e54cca7156575900866d5dba0fdf3fa6b2de0156f03693a069a3b41b1fe6fbb6 | 0 | 896 |
in decision
assert "match_reason" in decision
assert "action" in decision
assert decision["action"] == "skipped"
def test_run_dedup_logs_stats(self, settings: Settings, capfd: Any) -> None:
"""run() logs dedup_complete event with original/unique/filtered counts."""
... | jku-encyclopedia | tests/unit/test_scrapers/test_base_scraper.py | Python | 7f99b163a9f7582760f5936cd305066448c85070ba18ea77379bd20c16e49892 | 1 | 557 |
"""Unit tests for Europe PMC scraper."""
from __future__ import annotations
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.scrapers.europe_pmc import EuropePMCScraper, _result_to_raw_item
EPMC_RESULT = {
"id": "PMC12345",
"title": "xLSTM at JKU Linz",
... | jku-encyclopedia | tests/unit/test_scrapers/test_europe_pmc.py | Python | 360b20a5057d9eac2d60d2397124dc55fe2146fa5d2c44f9d77360afbbbdff30 | 0 | 862 |
"""Unit tests for GitHub scraper."""
from __future__ import annotations
import base64
import json
from pathlib import Path
import pytest
import respx
from jku_kb.models import FetchStatus, Modality, RawItem
from jku_kb.scrapers.github import (
JKU_GITHUB_ORGS,
GitHubScraper,
_is_source_file,
_repo_t... | jku-encyclopedia | tests/unit/test_scrapers/test_github.py | Python | 46708b312ed895072707e23a73c19ce39a68a619e7426925fa0cf7437f2373aa | 0 | 896 |
-----
# TestIsSourceFile
# ---------------------------------------------------------------------------
class TestIsSourceFile:
def test_accepts_py_in_src(self):
assert _is_source_file("src/model.py", "blob") is True
def test_accepts_ipynb_in_notebooks(self):
assert _is_source_file("notebooks/... | jku-encyclopedia | tests/unit/test_scrapers/test_github.py | Python | 84831367eeb969106fdc5967ec501b187ee2fefde307ac37ac2e1c3d6ad1cf5d | 1 | 896 |
orgs return empty
for org in JKU_GITHUB_ORGS:
mock_http_client.get(f"https://api.github.com/orgs/{org}/repos").respond(200, json=[])
scraper = GitHubScraper(settings)
items = await scraper.discover()
assert items == []
# Verify 7 calls were attempted — one per org (... | jku-encyclopedia | tests/unit/test_scrapers/test_github.py | Python | 76cd29faf3910c6e05545bcd73976121d482b09a537e60349327a66e3c1ed084 | 2 | 896 |
", "type": "blob", "size": 1000} for i in range(150)]
tree_data = {"sha": "deadbeef", "tree": tree_entries}
item = _make_github_item()
mock_http_client.get("https://api.github.com/repos/ml-jku/xLSTM/readme").respond(
200, json=self._readme_response()
)
mock_http_cli... | jku-encyclopedia | tests/unit/test_scrapers/test_github.py | Python | 9096a73b7e7f3ab950762273c2d32dc6f52b51776c4c3ed346d2eefd5c7a6689 | 3 | 896 |
caplog
# structlog in test mode emits to standard logging
# If structlog doesn't propagate, check via processor output
# The scraper uses self.log.debug("github_rate_limit", remaining=...)
# structlog events may appear differently; assert the fetch completed at minimum
result_ok ... | jku-encyclopedia | tests/unit/test_scrapers/test_github.py | Python | 458d7b3835ef5aeef424e5a5bfa20894910741b679b595d4602ff7685bc44cae | 4 | 70 |
"""Unit tests for the standalone BFS HTML crawler module."""
from __future__ import annotations
import asyncio
import pytest
import httpx
from jku_kb.scrapers.html_crawler import crawl_html, _normalize_url, _extract_links
# ---------------------------------------------------------------------------
# HTML fixture... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | ed005b3cb706086366129cb0a8f5812d38e66577dce24a8c97977dad5b3dbc6f | 0 | 896 |
TestNormalizeUrl:
def test_normalize_url_strips_fragment(self):
"""_normalize_url removes the URL fragment (#anchor) entirely."""
assert _normalize_url("https://a.jku.at/page#top") == "https://a.jku.at/page"
def test_normalize_url_strips_trailing_slash(self):
"""_normalize_url strips tr... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | 0afe16141a6c934154ea08bf2f16738fe78381468d5715ab9b89a7b76f36e049 | 1 | 896 |
'
'</body></html>'
)
links = _extract_links(html, "https://a.jku.at/")
# Only /page.html should be returned (no binary extensions)
assert len(links) == 1
assert links[0].endswith("/page.html")
def test_extract_links_resolves_relative_urls(self):
"""_extra... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | e53bbfceff122128f2e275c0b7354784a7120cadd0653c39de247929d21682c5 | 2 | 896 |
--
class TestCrawlHtml:
@pytest.mark.asyncio
async def test_crawl_html_discovers_pages(self):
"""crawl_html with mock fetch returning HTML with links discovers multiple pages."""
start = "https://a.jku.at/page-a"
url_responses = {
"https://a.jku.at/robots.txt": (200, ROBOTS... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | 092a2e818ed9ce8f447d2d1b61003d7a01f5e8e2668c57cbeff3ef942e44cac7 | 3 | 896 |
https://a.jku.at/private/secret": (200, private_html, "text/html"),
"https://a.jku.at/page-c": (200, PAGE_C, "text/html"),
}
fetch = make_mock_fetch(url_responses)
discovered = await crawl_html(start, fetch, lambda url: True, max_pages=10)
assert not any("/private/" in url fo... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | fe47d48d03438c6f27fb4fdbfa347275d852318dfd9f7636c16343b02f18af88 | 4 | 896 |
{"content-type": "text/html"}, request=httpx.Request("GET", url))
return httpx.Response(404, text="Not Found", headers={"content-type": "text/html"}, request=httpx.Request("GET", url))
discovered = await crawl_html("https://a.jku.at/page-a", fetch_with_error, lambda url: True, max_pages=10)
... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | f1ffc8daa1cee7229760835707892ffcc380fdc110d77a05d2079201db45789f | 5 | 896 |
[]
async def main_fetch(url: str) -> httpx.Response:
main_fetch_urls.append(url)
if url.endswith("/robots.txt"):
return httpx.Response(
200, text=ROBOTS_ALLOW_ALL,
headers={"content-type": "text/plain"},
request... | jku-encyclopedia | tests/unit/test_scrapers/test_html_crawler.py | Python | 7713209e09cd4803775abb908d6a4fe69585c46eab73b6b947cfc03434414ac6 | 6 | 693 |
"""Unit tests for HuggingFace scraper."""
from __future__ import annotations
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.models import Modality
from jku_kb.scrapers.huggingface import (
HuggingFaceScraper,
_dataset_to_raw_item,
_model_to_raw_item,
... | jku-encyclopedia | tests/unit/test_scrapers/test_huggingface.py | Python | cb77635dc710dac360101d02d43c6a7e6424efd0331ba6f2dc20cb3ccab4c2d9 | 0 | 896 |
Response(500))
mock_http_client.get("https://huggingface.co/api/datasets").mock(
return_value=Response(200, json=HF_DATASETS_FIXTURE)
)
scraper = HuggingFaceScraper(settings)
items = await scraper.discover()
await scraper.close()
# Models fail for all 3 auth... | jku-encyclopedia | tests/unit/test_scrapers/test_huggingface.py | Python | 1a5ed1e1c567b4999c73e902e63151929a5c3020e2e09b42e0e4d9e54e91a421 | 1 | 217 |
"""Unit tests for OpenAlex scraper."""
from __future__ import annotations
from pathlib import Path
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.models import FetchStatus, ManifestEntry, Modality, RawItem
from jku_kb.scrapers.openalex import OpenAlexScraper, _b... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex.py | Python | 8e05279e5a7dc7a513487b8da9824c21cc73653575407eb06a7d1b31d3eb782b | 0 | 896 |
//api.openalex.org/works").mock(
return_value=Response(500, json={"error": "Internal Server Error"})
)
scraper = OpenAlexScraper(settings)
items = await scraper.discover()
await scraper.close()
assert items == []
# -------------------------------------------------... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex.py | Python | ca4600b18f8248328217a1d896635484c39a0dab7c0768d0370f87d6d1558afc | 1 | 896 |
-
class TestOpenAlexFetch:
@pytest.mark.asyncio
async def test_fetch_metadata_as_text(self, settings: Settings, mock_http_client: respx.MockRouter):
"""fetch() saves metadata as text when no OA PDF URL available."""
item = RawItem(
item_id="W99999",
source_id="openalex_... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex.py | Python | 8f870e2aa612196c6ce480d81dee7b00937b2272a9e45089693213df594b2c97 | 2 | 896 |
is not None
assert item.modality == Modality.TEXT
def test_none_primary_location(self):
"""Work with None primary_location doesn't crash."""
work = {**SAMPLE_WORK, "primary_location": None, "open_access": {"oa_url": ""}}
item = _work_to_raw_item(work)
assert item is not None... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex.py | Python | 7a337f1afaa8278a4d0988af05073a7a5251429d370e0f252a32152c897877b9 | 3 | 527 |
"""Tests for OpenAlex cross-reference utility and discover xref writing."""
from __future__ import annotations
from pathlib import Path
import orjson
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.scrapers.openalex import OpenAlexScraper
from jku_kb.scrapers.ope... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex_xref.py | Python | edf24d84ff323109f7a57baf3b62a24a74fb7832ae56be7ff3238c59fece2a4e | 0 | 896 |
(parents=True)
xref_path = xref_dir / "discover_xref.jsonl"
lines = [
orjson.dumps({"arxiv_id": "2405.12345", "doi": "10.1234/xlstm"}),
orjson.dumps({"arxiv_id": "", "doi": "10.5678/other"}),
orjson.dumps({"arxiv_id": "2401.99999", "doi": ""}),
]
xref_... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex_xref.py | Python | be301411ad64fa6b84a30921b0952bed293e81a4ab9a0a366eba860eee94a164 | 1 | 896 |
"discover_xref.jsonl"
assert xref_path.exists(), "discover_xref.jsonl was not created"
lines = [line for line in xref_path.read_bytes().splitlines() if line.strip()]
assert len(lines) == 2
entry1 = orjson.loads(lines[0])
entry2 = orjson.loads(lines[1])
# First work has... | jku-encyclopedia | tests/unit/test_scrapers/test_openalex_xref.py | Python | ca43c593803c2994d90cd58359382ee6aaa9404436b9907980ea34bafdd3454d | 2 | 267 |
"""Unit tests for OpenCast scraper."""
from __future__ import annotations
import json
from typing import Any
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from jku_kb.models import FetchStatus, Modality, RawItem
from jku_kb.scrapers.opencast import (
OpenCastScraper,
_epi... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | 92ded51596d76124115ffe21142df364eecf54f38d441177f1eed095e2e29ba6 | 0 | 896 |
def test_tracks_extracted(self):
item = _episode_to_raw_item(SAMPLE_EPISODE)
assert item is not None
tracks = item.metadata.get("tracks", [])
assert len(tracks) == 2
assert tracks[0]["type"] == "presenter/delivery"
def test_duration_extracted(self):
item = _episode_t... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | ee2e76484bf8beda03e63ee517494370c5ed045c16617f50bb681e029cc69c24 | 1 | 896 |
//media.jku.at/search/episode.json",
params={"limit": "250", "offset": "250"},
).respond(200, json=_make_page(250))
# This should NOT be called — total=500, offset reaches 500 after 2 pages
third_page_route = mock_http_client.get(
"https://media.jku.at/search/episode.jso... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | e03bceff11c7edce2a70f3fcacaad7a482eaf03b6b6e0ed37a1ecff0ce607b36 | 2 | 896 |
250", "offset": "250"},
).respond(200, json=empty_data)
scraper = OpenCastScraper(settings)
items = await scraper.discover()
assert len(items) == 1, "Should discover 1 item via empty-result fallback"
@pytest.mark.asyncio
async def test_discover_partial_last_page(self, settings... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | 109c1413fa0e5a128b4e1d8a6e9055a91976faf1a410cf852df0922024270a19 | 3 | 896 |
ep002_presenter.mp4",
"mimetype": "video/mp4",
}
]
item = _make_raw_item("ep-test-002", tracks)
scraper = OpenCastScraper(settings)
async def fake_download(url: str, dest: Path, **kwargs: Any) -> tuple[int, str]:
dest.parent.mkdir(parents=True, ex... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | da8f16dfa27144ba83ab45a24bc6ec976f2005a73e041448f7d40caf6b9eb48b | 4 | 896 |
/cover_001.jpg",
"mimetype": "image/jpeg",
},
]
item = _make_raw_item("ep-att-002", tracks=[], attachments=attachments)
scraper = OpenCastScraper(settings)
mock_download = AsyncMock(return_value=(512, "def456"))
with patch.object(scraper, "_download_... | jku-encyclopedia | tests/unit/test_scrapers/test_opencast.py | Python | e000c392146d598f2d120e12a4567485955ae462eaa737598415743525d6084c | 5 | 96 |
"""Unit tests for PDF Fetch scraper."""
from __future__ import annotations
from pathlib import Path
import orjson
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.scrapers.pdf_fetch import PdfFetchScraper
# Updated fixture: HTML with table structure including tit... | jku-encyclopedia | tests/unit/test_scrapers/test_pdf_fetch.py | Python | 101f6e8666dd490825bf62de639d9a3bff6e3125e05f0a5bc496d9f182efe8b2 | 0 | 896 |
not just /publications/download/risc_ prefix."""
mock_http_client.get(
"https://www3.risc.jku.at/publications/index.php",
params={"division": "riscreports", "show_all": "true"},
).mock(
return_value=Response(200, text=RISC_HTML_FIXTURE, headers={"content-type": "text/... | jku-encyclopedia | tests/unit/test_scrapers/test_pdf_fetch.py | Python | 4c7c527008984be3b12a7452dfeb1b473cf7e980c16d887a335d96bfc76bfed5 | 1 | 896 |
()
await scraper.close()
# Find the item for paper.pdf
risc_7234 = next(
(i for i in items if "risc_7234/paper.pdf" in i.url),
None,
)
assert risc_7234 is not None, "Should have found paper.pdf item"
# metadata should include authors extracted fro... | jku-encyclopedia | tests/unit/test_scrapers/test_pdf_fetch.py | Python | cec8a1bf48f051b1087bad1231d6f572d0dd56504bbf6455d0f1cd726d67e69f | 2 | 896 |
mark.asyncio
async def test_discover_handles_missing_discovery_file(
self, settings: Settings, mock_http_client: respx.MockRouter
):
"""discover() works normally when web crawler discovery file doesn't exist."""
mock_http_client.get("https://www3.risc.jku.at/publications/index.php").mock... | jku-encyclopedia | tests/unit/test_scrapers/test_pdf_fetch.py | Python | 75e69b100a73b48c5f6cedfb1d52709cda85ef77d65669b3c55d2d1c8f92563d | 3 | 139 |
"""Unit tests for Podcast RSS scraper."""
from __future__ import annotations
from typing import ClassVar
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.models import Modality
from jku_kb.scrapers.podcast import JKU_PODCAST_FEEDS, PodcastScraper, _entry_to_raw_it... | jku-encyclopedia | tests/unit/test_scrapers/test_podcast.py | Python | 124932bb843ee4c5fa35c83d1d2e2a4a4375cb2bffd1d11a3300659191750ada | 0 | 896 |
mock_http_client.get(feed1_url).mock(return_value=Response(500))
mock_http_client.get(feed2_url).mock(
return_value=Response(200, text=RSS_FIXTURE, headers={"content-type": "application/rss+xml"})
)
scraper = PodcastScraper(settings)
items = await scraper.discover()
... | jku-encyclopedia | tests/unit/test_scrapers/test_podcast.py | Python | f6f82885f375f40108b4e1fdb44b42ba5f138879fc18b6b15641714d439d8c5d | 1 | 282 |
"""Unit tests for Semantic Scholar scraper."""
from __future__ import annotations
import json
from pathlib import Path
import pytest
import respx
from httpx import Response
from jku_kb.config import Settings
from jku_kb.scrapers.semantic_scholar import SemanticScholarScraper, _paper_to_raw_item
S2_PAPER = {
"p... | jku-encyclopedia | tests/unit/test_scrapers/test_semantic_scholar.py | Python | 5b1b587d598696857d5cc45492ed6e45cf037f9fbb35cfb7c364278de098c6db | 0 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.