Skip to content

Commit

Permalink
refactor(tests): refactor test folder structure
Browse files Browse the repository at this point in the history
This branch implements a restructuring of the test suite.

Rationale: Over-modularization of test parameter definitions clutters up the test
suite and leads to lengthy/repetitive import statements.

For now, the structure of the test suite should only differentiate
1. unit tests and 2. all other tests. Additional test categories may
be introduced at a later point.

The test category should be indicated in the test module doc string.

Closes #100
  • Loading branch information
lu-pl committed Nov 6, 2024
1 parent 318f630 commit 2b6ff37
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 313 deletions.
11 changes: 11 additions & 0 deletions tests/data/models/dummy_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Simple dummy models e.g. for count query constructor testing."""

from pydantic import BaseModel, ConfigDict


class Dummy(BaseModel):
pass


class GroupedDummy(BaseModel):
model_config = ConfigDict(group_by="x")
87 changes: 0 additions & 87 deletions tests/data/parameters/author_array_collection_model_parameters.py

This file was deleted.

28 changes: 0 additions & 28 deletions tests/data/parameters/author_work_title_model_parameters.py

This file was deleted.

49 changes: 0 additions & 49 deletions tests/data/parameters/basic_model_parameters.py

This file was deleted.

94 changes: 94 additions & 0 deletions tests/data/parameters/count_query_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
from tests.data.models.dummy_model import Dummy, GroupedDummy
from tests.utils._types import CountQueryParameter


construct_count_query_parameters = [
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(2 222 333)
}
}
""",
model=Dummy,
expected=3,
),
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(2 222 333)
}
}
""",
model=GroupedDummy,
expected=2,
),
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(1 22 33)
(2 222 333)
}
}
""",
model=Dummy,
expected=4,
),
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(1 22 33)
(2 222 333)
}
}
""",
model=GroupedDummy,
expected=2,
),
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(2 222 333)
(2 222 333)
}
}
""",
model=Dummy,
expected=4,
),
CountQueryParameter(
query="""
select ?x ?y ?z
where {
values (?x ?y ?z) {
(1 2 3)
(1 22 33)
(2 222 333)
(2 222 333)
}
}
""",
model=GroupedDummy,
expected=2,
),
]
42 changes: 0 additions & 42 deletions tests/data/parameters/grouping_model_parameters.py

This file was deleted.

Loading

0 comments on commit 2b6ff37

Please sign in to comment.