Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanderhaegen Cedrik committed Feb 11, 2015
2 parents 800b4d6 + 330e0bc commit 73cd988
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions atramhasis/validators.py
Expand Up @@ -281,13 +281,13 @@ def label_lang_rule(errors, node, languages_manager, labels):
languages_manager.save(language_item)


def concept_type_rule(errors, node_location, skos_manager, conceptscheme_id, members):
for member_concept_id in members:
member_concept = skos_manager.get_thing(member_concept_id, conceptscheme_id)
if member_concept.type != 'concept':
def concept_type_rule(errors, node_location, skos_manager, conceptscheme_id, items):
for item_concept_id in items:
item_concept = skos_manager.get_thing(item_concept_id, conceptscheme_id)
if item_concept.type != 'concept':
errors.append(colander.Invalid(
node_location,
'A member should always be a concept, not a collection'
'A narrower, broader or related concept should always be a concept, not a collection'
))


Expand Down
9 changes: 6 additions & 3 deletions tests/test_validation.py
Expand Up @@ -229,7 +229,8 @@ def test_related_concept_type_collection(self):
self.assertTrue(error_raised)
self.assertIsNone(validated_concept)
self.assertTrue(isinstance(error, ValidationError))
self.assertIn({'related': 'A member should always be a concept, not a collection'}, error.errors)
self.assertIn({'related': 'A narrower, broader or related concept'
' should always be a concept, not a collection'}, error.errors)

def test_collection_with_related(self):
# Collections can not have related relations
Expand Down Expand Up @@ -271,7 +272,8 @@ def test_narrower_concept_type_collection(self):
self.assertTrue(error_raised)
self.assertIsNone(validated_concept)
self.assertTrue(isinstance(error, ValidationError))
self.assertIn({'narrower': 'A member should always be a concept, not a collection'}, error.errors)
self.assertIn({'narrower': 'A narrower, broader or related concept'
' should always be a concept, not a collection'}, error.errors)

def test_collection_with_narrower(self):
# Collections can not have narrower relations
Expand Down Expand Up @@ -313,7 +315,8 @@ def test_broader_concept_type_collection(self):
self.assertTrue(error_raised)
self.assertIsNone(validated_concept)
self.assertTrue(isinstance(error, ValidationError))
self.assertIn({'broader': 'A member should always be a concept, not a collection'}, error.errors)
self.assertIn({'broader': 'A narrower, broader or related concept should always be'
' a concept, not a collection'}, error.errors)

def test_collection_with_broader(self):
# Collections can not have broader relations
Expand Down

0 comments on commit 73cd988

Please sign in to comment.