Skip to content

Commit

Permalink
test(keyword_trend): fix tests for adjusted queries
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpomerenke committed Jul 21, 2024
1 parent b6222ec commit 5060dda
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
17 changes: 11 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"python.defaultInterpreterPath": "${workspaceFolder}/backend-python/.venv",
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#042F2D",
"titleBar.activeForeground": "#ffffff"
},
"jupyter.notebookFileRoot": "${workspaceFolder}/backend-python/media_impact_monitor"
}
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#042F2D",
"titleBar.activeForeground": "#ffffff"
},
"jupyter.notebookFileRoot": "${workspaceFolder}/backend-python/media_impact_monitor",
"python.testing.pytestArgs": [
"backend-python/media_impact_monitor"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
3 changes: 0 additions & 3 deletions backend-python/media_impact_monitor/trends/keyword_trend.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from datetime import date

import pandas as pd
import yaml

Expand All @@ -9,7 +7,6 @@
from media_impact_monitor.data_loaders.news_print.genios import get_genios_counts
from media_impact_monitor.data_loaders.web.google_trends import get_google_trends_counts
from media_impact_monitor.types_ import TrendSearch
from media_impact_monitor.util.cache import cache
from media_impact_monitor.util.paths import src


Expand Down
15 changes: 8 additions & 7 deletions backend-python/media_impact_monitor/trends/keyword_trend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
def test_topic_queries():
for media_source in ["news_online", "news_print"]:
queries = topic_queries(media_source)
assert queries["science"].startswith(
"klimawandel OR klimaerwärmung OR erderwärmung"
assert queries["climate science"].startswith(
'klimaforsch* OR klimawissenschaft*'
)
assert queries["policy"].startswith(
"klimaneutral* OR klimaziel* OR klimaschutzpaket"
assert queries["climate policy"].startswith(
"klimapoliti* OR klimaneutral* OR klimaziel*"
)
assert '"erneuerbare energie*"' in queries["policy"]
assert '"erneuerbare energie*"' in queries["climate policy"]
queries = topic_queries("web_google")
assert "-\\*protest*" in queries["all_excl_activism"]
assert "+klimawandel" in queries["all_excl_activism"]
assert "+erderwärmung" in queries["climate science"]
# assert "-\\*protest*" in queries["all_excl_activism"]
# assert "+klimawandel" in queries["all_excl_activism"]

0 comments on commit 5060dda

Please sign in to comment.