forked from openlp/openlp
Make bible text parsing a bit more rebust, fixes bug 1404865.
Fixes: https://launchpad.net/bugs/1404865
This commit is contained in:
parent
35de35103b
commit
795977b094
@ -93,10 +93,10 @@ class BGExtract(RegistryProperties):
|
||||
"""
|
||||
if isinstance(tag, NavigableString):
|
||||
return None, str(tag)
|
||||
elif tag.get('class')[0] == "versenum" or tag.get('class')[0] == 'versenum mid-line':
|
||||
elif tag.get('class') and (tag.get('class')[0] == 'versenum' or tag.get('class')[0] == 'versenum mid-line'):
|
||||
verse = str(tag.string).replace('[', '').replace(']', '').strip()
|
||||
return verse, None
|
||||
elif tag.get('class')[0] == 'chapternum':
|
||||
elif tag.get('class') and tag.get('class')[0] == 'chapternum':
|
||||
verse = '1'
|
||||
return verse, None
|
||||
else:
|
||||
|
@ -85,6 +85,19 @@ class TestBibleHTTP(TestCase):
|
||||
# THEN: We should get back a valid service item
|
||||
assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed'
|
||||
|
||||
def bible_gateway_extract_verse_nkjv_test(self):
|
||||
"""
|
||||
Test the Bible Gateway retrieval of verse list for NKJV bible John 3
|
||||
"""
|
||||
# GIVEN: A new Bible Gateway extraction class
|
||||
handler = BGExtract()
|
||||
|
||||
# WHEN: The Books list is called
|
||||
results = handler.get_bible_chapter('NKJV', 'John', 3)
|
||||
|
||||
# THEN: We should get back a valid service item
|
||||
assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed'
|
||||
|
||||
def crosswalk_extract_books_test(self):
|
||||
"""
|
||||
Test Crosswalk retrieval of book list for NIV bible
|
||||
|
Loading…
Reference in New Issue
Block a user