Skip to content

Commit

Permalink
chore: remove dead parameter in ontology client (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora-Olivia-Ammann committed Feb 13, 2024
1 parent 9f06f3f commit 8095ba3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/dsp_tools/commands/xmlupload/ontology_client.py
@@ -1,5 +1,4 @@
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Protocol

from dsp_tools.commands.xmlupload.models.ontology_lookup_models import OntoInfo, extract_classes_properties_from_onto
Expand All @@ -17,7 +16,6 @@ class OntologyClient(Protocol):
con: Connection
shortcode: str
default_ontology: str
save_location: Path
ontology_names: list[str] = field(default_factory=list)

def get_all_ontologies_from_server(self) -> dict[str, OntoInfo]:
Expand All @@ -34,7 +32,6 @@ class OntologyClientLive:
con: Connection
shortcode: str
default_ontology: str
save_location: Path
ontology_names: list[str] = field(default_factory=list)

def get_all_ontologies_from_server(self) -> dict[str, OntoInfo]:
Expand Down
1 change: 0 additions & 1 deletion src/dsp_tools/commands/xmlupload/xmlupload.py
Expand Up @@ -92,7 +92,6 @@ def xmlupload(
con=con,
shortcode=shortcode,
default_ontology=default_ontology,
save_location=config.diagnostics.save_location,
)
do_xml_consistency_check_with_ontology(onto_client=ontology_client, root=root)

Expand Down
@@ -1,6 +1,5 @@
import re
from dataclasses import dataclass
from pathlib import Path
from test.unittests.commands.xmlupload.connection_mock import ConnectionMockBase
from typing import Any

Expand Down Expand Up @@ -66,7 +65,6 @@ def test_error_on_nonexistent_shortcode() -> None:
con=con,
shortcode="9999",
default_ontology="foo",
save_location=Path("bar"),
)
with pytest.raises(UserError, match="A project with shortcode 9999 could not be found on the DSP server"):
do_xml_consistency_check_with_ontology(ontology_client, root)
Expand All @@ -83,7 +81,6 @@ def test_error_on_nonexistent_onto_name() -> None:
con=con,
shortcode="4124",
default_ontology="notexistingfantasyonto",
save_location=Path("bar"),
)
expected = re.escape(
"\nSome property and/or class type(s) used in the XML are unknown.\n"
Expand Down
7 changes: 3 additions & 4 deletions test/unittests/commands/xmlupload/test_ontology_client.py
@@ -1,5 +1,4 @@
from dataclasses import dataclass
from pathlib import Path
from test.unittests.commands.xmlupload.connection_mock import ConnectionMockBase
from typing import Any

Expand Down Expand Up @@ -39,7 +38,7 @@ def test_get_ontology_names_from_server() -> None:
}
}
con = ConnectionMock(response)
onto_client = OntologyClientLive(con, "0801", "beol", Path(""))
onto_client = OntologyClientLive(con, "0801", "beol")
onto_client._get_ontology_names_from_server()
assert unordered(onto_client.ontology_names) == ["biblio", "newton", "leibniz", "beol"]

Expand All @@ -58,7 +57,7 @@ def test_get_ontology_from_server() -> None:
"@context": {},
}
con = ConnectionMock(response)
onto_client = OntologyClientLive(con, "0801", "beol", Path(""))
onto_client = OntologyClientLive(con, "0801", "beol")
res_graph = onto_client._get_ontology_from_server("beol")
assert unordered(res_graph) == [{"resource_class": ["Information"]}, {"property": ["Information"]}]

Expand All @@ -77,6 +76,6 @@ def test_get_knora_api_from_server() -> None:
"@context": {},
}
con = ConnectionMock(response)
onto_client = OntologyClientLive(con, "", "", Path(""))
onto_client = OntologyClientLive(con, "", "")
res_graph = onto_client.get_knora_api_ontology_from_server()
assert unordered(res_graph) == [{"resource_class": ["Information"]}, {"property": ["Information"]}]

0 comments on commit 8095ba3

Please sign in to comment.