Skip to content

Commit

Permalink
add test for transform_date
Browse files Browse the repository at this point in the history
add skip logic for ublad test

install language pack in test

update test settings
  • Loading branch information
Meesch committed Jun 18, 2024
1 parent 212ed79 commit 78d64bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions backend/corpora/ublad/tests/test_ublad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import locale
import pytest
from corpora.ublad.ublad import transform_date
import datetime


def test_transform_date():
datestring = '6 september 2007'
goal_date = datetime.date(2007, 9, 6)
try:
date = transform_date(datestring)
except locale.Error:
pytest.skip('Dutch Locale not installed in environment')
assert date == str(goal_date)
2 changes: 2 additions & 0 deletions backend/ianalyzer/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ def test_corpus_path(*path):
TIMES_DATA = os.path.join(BASE_DIR, 'addcorpus', 'python_corpora', 'tests')
TIMES_ES_INDEX = 'times-test'

UBLAD_DATA = '' # necessary to make ublad test not fail

SERVERS['default']['index_prefix'] = 'test'

0 comments on commit 78d64bc

Please sign in to comment.