Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added changing --- and ---- to --.

  • Loading branch information...
commit f134f0a33ab557eff3d5fcaaab66fc701a8a6c4a 1 parent 6a52b3f
Szymon Guz authored
Showing with 6 additions and 2 deletions.
  1. +1 −1  lib/akamod/enrich-subject.py
  2. +5 −1 test/test_enrich_subject.py
View
2  lib/akamod/enrich-subject.py
@@ -19,7 +19,7 @@ def enrichsubject(body,ctype,action="enrich-subject",prop="sourceResource/subjec
'''
TAGS_FOR_STRIPPING = '[\.\' ";]*' # Tags for stripping at beginning and at the end.
- REGEXPS = ('\s*--\s*', '--'), \
+ REGEXPS = ('\s*-{2,4}\s*', '--'), \
('\s*-\s*-\s*', '--'), \
('^' + TAGS_FOR_STRIPPING, ''), \
(TAGS_FOR_STRIPPING + '$','')
View
6 test/test_enrich_subject.py
@@ -204,7 +204,9 @@ def test_enrichment_for_creator_field():
"aaa --bbb",
"aaa-- bbb",
"aaa -- bbb",
- "aaa -- bbb -- ccc - - ddd -- "
+ "aaa -- bbb -- ccc - - ddd -- ",
+ "aaa --- bbb --- ccc--- ddd---",
+ "aaa ---- bbb ----ccc---- ddd----"
]
}
EXPECTED = {
@@ -227,6 +229,8 @@ def test_enrichment_for_creator_field():
{"name": "Aaa--bbb"},
{"name": "Aaa--bbb"},
{"name": "Aaa--bbb--ccc--ddd--"},
+ {"name": "Aaa--bbb--ccc--ddd--"},
+ {"name": "Aaa--bbb--ccc--ddd--"}
]
}
resp, content = _get_server_response(json.dumps(INPUT), "creator")
Please sign in to comment.
Something went wrong with that request. Please try again.