Skip to content

Commit

Permalink
add tests for multilang-support
Browse files Browse the repository at this point in the history
  • Loading branch information
stefina committed Oct 12, 2018
1 parent 6192fca commit 6157c63
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ckanext/dcat/tests/test_base_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,33 @@ def test_object_value_not_found(self):

eq_(value, '')

def test_object_value_multilang(self):

p = RDFProfile(_default_graph())

p.g.add((URIRef('http://example.org/datasets/1'),
DCT.title, Literal('Test Datensatz 1', lang='de')))

p.g.add((URIRef('http://example.org/datasets/1'),
DCT.title, Literal('Test Dataset 1', lang='en')))

value = p._object_value(URIRef('http://example.org/datasets/1'),
DCT.title, multilang=True)

assert isinstance(value, dict)
eq_(value.get('de'), u'Test Datensatz 1')
eq_(value.get('en'), u'Test Dataset 1')

def test_object_value_multilang_missing_lang_param(self):

p = RDFProfile(_default_graph())

value = p._object_value(URIRef('http://example.org/datasets/1'),
DCT.title, multilang=True)

assert isinstance(value, dict)
eq_(value.get('en'), u'Test Dataset 1')

def test_object_int(self):

p = RDFProfile(_default_graph())
Expand Down

0 comments on commit 6157c63

Please sign in to comment.