Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
- Rename the test data directory for `translate_algebra` to match other
  test data directories. (i.e. `test_translate_algebra` -> `translate_algebra`)
- Remove `types-tabulate` form requirements.dev.txt as this was only
  used in the custom test framework.
- Fix translate algebra docstring.
- Add a TODO comment expressing the intent to evaluate algebra tests
  against a well defined graph and verify the result from the
  reconstituted query matches the result from the raw query.
  • Loading branch information
aucampia committed Dec 31, 2021
1 parent 203bcc2 commit 052e88b
Show file tree
Hide file tree
Showing 43 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ pytest-subtests
sphinx
sphinxcontrib-apidoc
types-setuptools
types-tabulate
12 changes: 8 additions & 4 deletions test/test_translate_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@pytest.fixture
def data_path() -> Path:
return Path(__file__).parent / "test_translate_algebra"
return Path(__file__).parent / "translate_algebra"


@dataclass
Expand All @@ -33,7 +33,7 @@ def filename(self) -> str:
def pytest_param(self) -> ParameterSet:
return pytest.param(self, id=self.id, marks=self.marks)


memory
def _format_query(query: str) -> str:
buffer = StringIO()
p = "{"
Expand Down Expand Up @@ -232,7 +232,7 @@ def _format_query(query: str) -> str:


if os.name != "nt":
# On Windows this test causes a stackoverflow or memroy error, so don't run
# On Windows this test causes a stackoverflow or memory error, so don't run
# it on Windows. The test fails anyway on linux and should be fixed. Once
# the cause of this failure is fixed the condition to not run it on windows
# should be removed and it should be added to the normal tests.
Expand Down Expand Up @@ -266,7 +266,7 @@ def test_all_files_used(data_path: Path) -> None:
@pytest.mark.parametrize("test_spec", [test.pytest_param() for test in algebra_tests])
def test_roundtrip(test_spec: AlgebraTest, data_path: Path) -> None:
"""
The query must also be executable and shall not violate any SPARQL query syntax.
Query remains the same over two successuive parse and translate cycles.
"""
query_text = (data_path / test_spec.filename).read_text()

Expand All @@ -285,3 +285,7 @@ def test_roundtrip(test_spec: AlgebraTest, data_path: Path) -> None:
assert (
query_from_algebra == query_from_query_from_algebra
), f"failed expectation: {test_spec.description}"

# TODO: Execute the raw query (query_text) and the reconstitued query
# (query_from_query_from_algebra) against a well defined graph and ensure
# they yield the same result.

0 comments on commit 052e88b

Please sign in to comment.