dev #15
@@ -1,7 +0,0 @@
|
||||
[run]
|
||||
branch = True
|
||||
omit = */build/*,tests/*,main.py
|
||||
[report]
|
||||
exclude_lines =
|
||||
pragma: no cover
|
||||
raise NotImplementedError.*
|
||||
@@ -71,3 +71,67 @@ markers = [
|
||||
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["src"]
|
||||
branch = true
|
||||
omit = [
|
||||
"*/tests/*",
|
||||
"*/test_*.py",
|
||||
"*/__pycache__/*",
|
||||
"*/.venv/*",
|
||||
"*/site-packages/*",
|
||||
"test.py",
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
precision = 2
|
||||
show_missing = true
|
||||
skip_covered = false
|
||||
exclude_lines = [
|
||||
"pragma: no cover",
|
||||
"def __repr__",
|
||||
"raise AssertionError",
|
||||
"raise NotImplementedError",
|
||||
"if __name__ == .__main__.",
|
||||
"if TYPE_CHECKING:",
|
||||
"@abstractmethod",
|
||||
"@abc.abstractmethod",
|
||||
]
|
||||
|
||||
[tool.coverage.html]
|
||||
directory = "htmlcov"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.13"
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
disallow_untyped_defs = false
|
||||
disallow_incomplete_defs = false
|
||||
check_untyped_defs = true
|
||||
no_implicit_optional = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
warn_no_return = true
|
||||
strict_equality = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "tests.*"
|
||||
ignore_errors = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
"regex.*",
|
||||
"requests.*",
|
||||
"bs4.*",
|
||||
"ratelimit.*",
|
||||
"pytest.*",
|
||||
"pytest_mock.*",
|
||||
"bibapi._transformers",
|
||||
"bibapi.webrequest",
|
||||
"bibapi.catalogue",
|
||||
"bibapi.lehmanns",
|
||||
"bibapi.schemas.bookdata",
|
||||
"bibapi.sru",
|
||||
]
|
||||
ignore_missing_imports = true
|
||||
ignore_errors = true
|
||||
|
||||
@@ -6,7 +6,9 @@ from dataclasses import dataclass
|
||||
from dataclasses import field as dataclass_field
|
||||
from typing import Any
|
||||
|
||||
from src.bibapi.schemas.bookdata import BookData
|
||||
from regex import sub
|
||||
|
||||
from .schemas.bookdata import BookData
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -14,6 +14,7 @@ class PicaSchema(Enum):
|
||||
AUTHOR = "pica.per"
|
||||
YEAR = "pica.jhr"
|
||||
AUTHOR_SCHEMA = "NoSpaceAfterComma"
|
||||
LIBRARY = "pica.bib"
|
||||
ENCLOSE_TITLE_IN_QUOTES = False
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from bs4 import BeautifulSoup
|
||||
# import sleep_and_retry decorator to retry requests
|
||||
from ratelimit import limits, sleep_and_retry
|
||||
|
||||
from src.bibapi._transformers import (
|
||||
from ._transformers import (
|
||||
RDS_AVAIL_DATA,
|
||||
RDS_GENERIC_DATA,
|
||||
ARRAYData,
|
||||
@@ -22,7 +22,7 @@ from src.bibapi._transformers import (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.bibapi.schemas.bookdata import BookData
|
||||
from .schemas.bookdata import BookData
|
||||
|
||||
API_URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndexrecord/{}/"
|
||||
PPN_URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
|
||||
|
||||
@@ -20,10 +20,9 @@ from src.bibapi import SWB
|
||||
# --- Integration test (requires network) ---
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_swb_schema() -> None:
|
||||
"""Integration test that requires network access."""
|
||||
result = SWB().getBooks(["pica.tit=Java ist auch eine Insel", "pica.bib=20735"])
|
||||
result = SWB().getBooks(["TITLE=Java ist auch eine Insel", "LIBRARY=20735"])
|
||||
assert len(result) == 1
|
||||
assert result[0].title == "Java ist auch eine Insel"
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class TestWebRequest:
|
||||
mock_response.text = "192.168.1.1" # Not in ALLOWED_IPS
|
||||
mock_get.return_value = mock_response
|
||||
|
||||
with pytest.raises(PermissionError, match="IP not allowed"):
|
||||
with pytest.raises(PermissionError, match="not allowed"):
|
||||
WebRequest()
|
||||
|
||||
def test_webrequest_init_allowed_ip(self):
|
||||
|
||||
Reference in New Issue
Block a user