Skip to content

Commit

Permalink
Add test for case when SKOS vocabulary file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
osma committed Aug 16, 2021
1 parent 7c11d1e commit 5bd4253
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_vocab.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""Unit tests for vocabulary functionality in Annif"""

import pytest
import os
import annif.corpus
import annif.vocab
from annif.exception import NotInitializedException
import rdflib.namespace


Expand Down Expand Up @@ -103,6 +105,17 @@ def test_skos_cache(tmpdir):
assert tmpdir.join('vocabs/vocab-id/subjects.joblib.gz').exists()


def test_skos_not_found(tmpdir):
vocab = load_dummy_vocab(tmpdir)
assert tmpdir.join('vocabs/vocab-id/subjects.ttl').exists()
assert tmpdir.join('vocabs/vocab-id/subjects.joblib.gz').exists()
tmpdir.join('vocabs/vocab-id/subjects.ttl').remove()
tmpdir.join('vocabs/vocab-id/subjects.joblib.gz').remove()

with pytest.raises(NotInitializedException):
vocab.skos


def test_as_graph(tmpdir):
vocab = load_dummy_vocab(tmpdir)
graph = vocab.as_graph()
Expand Down

0 comments on commit 5bd4253

Please sign in to comment.