Skip to content

Commit

Permalink
Merge 5d96b49 into fc09001
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed Nov 13, 2019
2 parents fc09001 + 5d96b49 commit 1a89373
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
install:
- pip install -U setuptools
- pip install -r requirements-dev.txt #fix versions
Expand Down
9 changes: 8 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
0.2.1 (2019-11-13)
------------------

- Update supported Python version (#61)
- Add a long_description_content_type (#55)
- Correct handling of get_by_uri (#69)

0.2.0 (2017-08-24)
------------------

- Update to skosprovider 0.6.1:
- Update to skosprovider 0.6.1
- Allow Notes with HTML (#17)
- Add languages to Conceptscheme (#18)
- Add sources to Conceptscheme, Collection and Concept (#19)
Expand Down
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@

# General information about the project.
project = u'skosprovider_atramhasis'
copyright = u'2015, Flanders Heritage Agency'
copyright = u'2015-2019, Flanders Heritage Agency'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.0'
version = '0.2'
# The full version, including alpha/beta/rc tags.
release = '0.0.0'
release = '0.2.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
15 changes: 9 additions & 6 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
--requirement requirements.txt

# Documentation
Sphinx==1.7.8
Sphinx==1.8.5 ; python_version < '3.5'
Sphinx==2.2.0 ; python_version >= '3.5'

#testing
tox==3.2.1
pytest==3.7.4
pytest-cov==2.5.1
responses==0.9.0
# Unit testing
tox==3.14.0
pytest==4.6.6 ; python_version < '3.0'
pytest==5.2.1 ; python_version >= '3.0'
responses==0.10.6
pytest-cov==2.8.1
coveralls==1.8.2
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.19.1
requests==2.22.0
skosprovider==0.6.1
#-e git+https://github.com/koenedaele/skosprovider.git#egg=skosprovider
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
]

requires = [
'skosprovider>=0.5.0',
'skosprovider>=0.6.0',
'requests'
]
setup(
name='skosprovider_atramhasis',
version='0.2.0',
version='0.2.1',
description='Skosprovider implementation of Atramhasis Vocabularies',
long_description=README,
long_description_content_type='x-rst',
packages=packages,
include_package_data=True,
install_requires=requires,
Expand All @@ -32,9 +33,9 @@
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
author='Flanders Heritage Agency',
author_email='ict@onroerenderfgoed.be',
Expand Down
5 changes: 3 additions & 2 deletions skosprovider_atramhasis/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def get_by_uri(self, uri):
:param (str) uri: string uri of the :class:`skosprovider.skos.Concept` or :class:`skosprovider.skos.Concept`
:return: corresponding :class:`skosprovider.skos.Concept` or :class:`skosprovider.skos.Concept`.
"""
request = self.base_url + "/uris/" + uri
response = self._request(request, {'Accept': 'application/json'})
request = self.base_url + "/uris"
params = {'uri': uri}
response = self._request(request, {'Accept': 'application/json'}, params)
if response.status_code == 404:
return False
if response.json()['concept_scheme']['id'] != self.scheme_id:
Expand Down
1 change: 0 additions & 1 deletion skosprovider_atramhasis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def dict_to_thing(dict):
raise ValueError("type: type is not valid ('concept', 'collection') in dict")
thing.type = type
thing.uri = dict['uri'] if 'uri' in dict else None
thing.label = dict['label'] if 'label' in dict else None
thing.concept_scheme = ConceptScheme(dict['concept_scheme']) if 'concept_scheme' in dict else None
if 'labels' in dict:
thing.labels = [(dict_to_label(l)) for l in dict['labels']]
Expand Down
40 changes: 26 additions & 14 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,32 @@ def init_responses():
status=404,
content_type='application/json')

responses.add(responses.GET, 'http://localhost/uris/http://localhost/conceptschemes/STYLES/c/1',
body='{"id": 1,"type": "concept","concept_scheme": {"id": "STYLES", "uri": "http://localhost/conceptschemes/STYLES"},"uri": "http://localhost/conceptschemes/STYLES/c/1"}',
status=200,
content_type='application/json')

responses.add(responses.GET, 'http://localhost/uris/http://localhost/conceptschemes/STYLES/c/1234',
body='{"id": 1,"type": "concept","concept_scheme": {"id": "STIJLEN", "uri": "http://localhost/conceptschemes/STIJLEN"},"uri": "http://localhost/conceptschemes/STYLES/c/1234"}',
status=200,
content_type='application/json')

responses.add(responses.GET, 'http://localhost/uris/http://localhost/conceptschemes/STYLES/c/1234567',
body='{"message": "The resource could not be found."}',
status=404,
content_type='application/json')
responses.add(
responses.GET,
'http://localhost/uris?uri=http://localhost/conceptschemes/STYLES/c/1',
match_querystring=True,
body='{"id": 1,"type": "concept","concept_scheme": {"id": "STYLES", "uri": "http://localhost/conceptschemes/STYLES"},"uri": "http://localhost/conceptschemes/STYLES/c/1"}',
status=200,
content_type='application/json'
)

responses.add(
responses.GET,
'http://localhost/uris?uri=http://localhost/conceptschemes/STYLES/c/1234',
match_querystring=True,
body='{"id": 1,"type": "concept","concept_scheme": {"id": "STIJLEN", "uri": "http://localhost/conceptschemes/STIJLEN"},"uri": "http://localhost/conceptschemes/STYLES/c/1234"}',
status=200,
content_type='application/json'
)

responses.add(
responses.GET,
'http://localhost/uris?uri=http://localhost/conceptschemes/STYLES/c/1234567',
match_querystring=True,
body='{"message": "The resource could not be found."}',
status=404,
content_type='application/json'
)

responses.add(responses.GET, 'http://localhost/conceptschemes/STYLES',
body='{"uri": "https://id.erfgoed.net/thesauri/stijlen_en_culturen", "label": "Styles and Cultures", "notes": [], "sources": [], "languages": [], "id": "STYLES", "labels": [{"type": "prefLabel", "label": "Stijlen en Culturen", "language": "nl"}, {"type": "prefLabel", "label": "Styles and Cultures", "language": "en"}], "subject": []}',
Expand Down
7 changes: 7 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def test_dict_to_thing_concept(self):
self.assertEqual(concept.type, "concept")
self.assertEqual(concept.uri, self.concept['uri'])

def test_dict_to_thing_concept_can_still_call_label(self):
concept = dict_to_thing(self.concept)

label = concept.label()

self.assertEqual(label.label, 'The Chestnut')

def test_dict_to_thing_concept_return(self):
concept = Concept("uri", "scheme")
concept_2 = dict_to_thing(concept)
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py33, py34, py35, cover
envlist = py27, py35, py36, py37, cover

[testenv]
commands =
Expand All @@ -11,7 +11,7 @@ deps =

[testenv:cover]
basepython =
python2.7
python3.7
commands =
pip install -r requirements-dev.txt
python setup.py develop
Expand Down

0 comments on commit 1a89373

Please sign in to comment.