Skip to content

Commit

Permalink
Merge pull request #70 from NatLibFi/config-parser-fix
Browse files Browse the repository at this point in the history
Config parser fix (again)
  • Loading branch information
osma authored Oct 9, 2020
2 parents 864c2b4 + 69c97b7 commit 8014fd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion skosify/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def expand_curielike(namespaces, curie):
return curie

if ns in namespaces:
return URIRef(namespaces[ns].term(localpart))
return URIRef(str(namespaces[ns]) + localpart)
else:
logging.warning("Unknown namespace prefix %s", ns)
return URIRef(curie)
Expand Down
12 changes: 12 additions & 0 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,17 @@ def test_empty_config_file():
cfg.close()


def test_config_file_with_closed_namespace():
cfg = StringIO()
cfg.write(u'''
[literals]
rdfs.comment_EN=rdfs.comment
''')
cfg.seek(0)
config = skosify.config(cfg)
assert set(config['namespaces'].keys()) == set(['owl', 'rdf', 'xsd', 'rdfs', 'dct', 'skos', 'dc'])
cfg.close()


if __name__ == '__main__':
unittest.main()

0 comments on commit 8014fd8

Please sign in to comment.