Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
Remove empty test_query.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dpriskorn committed Oct 6, 2022
1 parent a97f3ea commit 54f2c9e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
11 changes: 8 additions & 3 deletions tests/test_preprint_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def test_preprint_article_query(self):
q.search_string = string
q.__prepare_and_build_query__()
print(q.query_string)
assert q.query_string.replace(" ","").strip() == """
assert (
q.query_string.replace(" ", "").strip()
== """
#ItemSubjector (https://github.com/dpriskorn/ItemSubjector), User:So9q
SELECT DISTINCT ?item ?itemLabel
WHERE {
Expand All @@ -42,5 +44,8 @@ def test_preprint_article_query(self):
)
MINUS {?item wdt:P921/wdt:P279 wd:Q407541. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}""".replace(" ","").strip()
break
}""".replace(
" ", ""
).strip()
)
break
13 changes: 10 additions & 3 deletions tests/test_published_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def test_published_article_query(self):
q.search_string = string
q.__prepare_and_build_query__()
print(q.query_string)
assert q.query_string.replace(" ","").replace("\\", "").strip() == """
assert (
q.query_string.replace(" ", "").replace("\\", "").strip()
== """
#ItemSubjector (https://github.com/dpriskorn/ItemSubjector), User:So9q
SELECT DISTINCT ?item ?itemLabel
WHERE {
Expand Down Expand Up @@ -54,5 +56,10 @@ def test_published_article_query(self):
MINUS {?item wdt:P921/wdt:P279/wdt:P279 wd:Q407541. }
MINUS {?item wdt:P921/wdt:P279/wdt:P279/wdt:P279 wd:Q407541. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}""".replace(" ","").replace("\\", "").strip()
break
}""".replace(
" ", ""
)
.replace("\\", "")
.strip()
)
break
9 changes: 0 additions & 9 deletions tests/test_query.py

This file was deleted.

15 changes: 11 additions & 4 deletions tests/test_riksdagen_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

from src import tasks
from src.models.wikimedia.wikidata.item.main_subject import MainSubjectItem
from src.models.wikimedia.wikidata.query.riksdagen_document import RiksdagenDocumentQuery
from src.models.wikimedia.wikidata.query.riksdagen_document import (
RiksdagenDocumentQuery,
)


class TestRiksdagenDocumentQuery(TestCase):
Expand All @@ -23,7 +25,9 @@ def test_riksdagen_document_query(self):
q.search_string = string
q.__prepare_and_build_query__()
print(q.query_string)
assert q.query_string.replace(" ","").strip() == """
assert (
q.query_string.replace(" ", "").strip()
== """
#ItemSubjector (https://github.com/dpriskorn/ItemSubjector), User:So9q
SELECT DISTINCT ?item ?itemLabel
WHERE {
Expand All @@ -47,5 +51,8 @@ def test_riksdagen_document_query(self):
# Thanks to Jan Ainali for this improvement :)
MINUS {?main_subject_item wdt:P921 ?topic. ?topic wdt:P279 wd:Q407541. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv". }
}""".replace(" ","").strip()
break
}""".replace(
" ", ""
).strip()
)
break
11 changes: 8 additions & 3 deletions tests/test_thesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def test_thesis_query(self):
q.search_string = string
q.__prepare_and_build_query__()
print(q.query_string)
assert q.query_string.replace(" ","").strip() == """
assert (
q.query_string.replace(" ", "").strip()
== """
#ItemSubjector (https://github.com/dpriskorn/ItemSubjector), User:So9q
SELECT DISTINCT ?item ?itemLabel
WHERE {
Expand All @@ -45,5 +47,8 @@ def test_thesis_query(self):
REGEX(LCASE(?label), "^fentanyl .*"@en))
MINUS {?item wdt:P921 ?topic. ?topic wdt:P279 wd:Q407541. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}""".replace(" ","").strip()
break
}""".replace(
" ", ""
).strip()
)
break

0 comments on commit 54f2c9e

Please sign in to comment.