コード例 #1
0
ファイル: test.py プロジェクト: genebot/pyricope
 def test_pericope_substitution(self):
     text = "2 Peter 3:1-2 Lorem ipsum dolor sit amet"
     expected_text = "{{61003001 61003002}} Lorem ipsum dolor sit amet"
     actual_text = Pyricope.sub(text)
     self.assertEqual(expected_text, actual_text)
     
     expected_text, text = text, expected_text
     actual_text = Pyricope.rsub(text)
     self.assertEqual(expected_text, actual_text)
コード例 #2
0
ファイル: test.py プロジェクト: genebot/pyricope
 def test_pericope_extraction(self):
     text = """2 Peter 4.1 Lorem ipsum dolor sit amet, Mark consectetur adipiscing elit 7. 1-2 Donec aliquam erat luctus
         lacinia. Cras aliquet urna sed massa viverra eget ultricies risus sodales. Maecenas aliquet felis nec
         justo pharetra rutrum eget a risus. (Jas. 1:13, 20) Etiam tincidunt pellentesque cursus. Nulla est libero,
         bibendum sed elementum vitae, elementum vehicula quam. In bibendum massa sed quam convallis sed lacinia
         orci aliquet. Donec tempus sodales, jn 21:14, zech 4:7, mk 3-1, and mt 12:13. Vestibulum nec nibh dolor,
         vel hendrerit libero. Donec porta felis at lectus condimentum sollicitudin. Donec samuel magna in leo
         vestibulum aliquam. Suspendisse eget magna leo 3\"2-1, in rutrum metus. Pellentesque nec lectus imperdiet
         arcu venenatis placerat in quis diam. Luke 2---Mauris enim sapien, feugiat at vulputate ac, imperdiet sit
         amet tellus. Donec posuere nisi odio, et laoreet libero. Luke 3\"1---Aliquam iaculis, elit sed venenatis
         suscipit, tellus nibh sodales tortor, non lobortis neque sapien quis ante. Vivamus laoreet, mi eu imperdiet
         bibendum, purus orci iaculis mi, vel first kings mi nisi auctor mauris. Integer dapibus lacinia arcu, ac
         dignissim justo consectetur sit amet. (Acts 13:4-20)"""
     expected_text = """ Lorem ipsum dolor sit amet, Mark consectetur adipiscing elit 7. 1-2 Donec aliquam erat luctus
         lacinia. Cras aliquet urna sed massa viverra eget ultricies risus sodales. Maecenas aliquet felis nec
         justo pharetra rutrum eget a risus. () Etiam tincidunt pellentesque cursus. Nulla est libero,
         bibendum sed elementum vitae, elementum vehicula quam. In bibendum massa sed quam convallis sed lacinia
         orci aliquet. Donec tempus sodales, , , , and . Vestibulum nec nibh dolor,
         vel hendrerit libero. Donec porta felis at lectus condimentum sollicitudin. Donec samuel magna in leo
         vestibulum aliquam. Suspendisse eget magna leo 3\"2-1, in rutrum metus. Pellentesque nec lectus imperdiet
         arcu venenatis placerat in quis diam. ---Mauris enim sapien, feugiat at vulputate ac, imperdiet sit
         amet tellus. Donec posuere nisi odio, et laoreet libero. ---Aliquam iaculis, elit sed venenatis
         suscipit, tellus nibh sodales tortor, non lobortis neque sapien quis ante. Vivamus laoreet, mi eu imperdiet
         bibendum, purus orci iaculis mi, vel first kings mi nisi auctor mauris. Integer dapibus lacinia arcu, ac
         dignissim justo consectetur sit amet. ()"""
         
     expected_results = [
       "2 Peter 3:1",
       "James 1:13, 20",
       "John 21:14",
       "Zechariah 4:7",
       "Mark 3",
       "Matthew 12:13",
       "Luke 2",
       "Luke 3:1",
       "Acts 13:4-20"
     ]
     
     actual_text, actual_results = "", []
     
     for elem in Pyricope.split(text):
         if isinstance(elem, Pyricope):
             actual_results.append(str(elem))
         else:
             actual_text += elem
     
     self.assertEqual(expected_results, actual_results)
     self.assertEqual(expected_text, actual_text)
コード例 #3
0
ファイル: test.py プロジェクト: genebot/pyricope
 def test_splitting_text_with_pericopes(self):
     text = "Paul, rom. 12:1-4, Romans 9:7, 11, Election, Theology of Glory, Theology of the Cross, 1 Cor 15, Resurrection"
     expected_keywords = [
         "Paul",
         "Romans 12:1-4",
         "Romans 9:7, 11",
         "Election",
         "Theology of Glory",
         "Theology of the Cross",
         "1 Corinthians 15",
         "Resurrection"
     ]
     keywords = compact(flatten([str(arg) if isinstance(arg, Pyricope) else [ar.strip() for ar in arg.split(',')] for arg in Pyricope.split(text)]))
     self.assertEqual(expected_keywords, keywords)
コード例 #4
0
ファイル: test.py プロジェクト: genebot/pyricope
 def test_just_chapters(self):
     pericope = Pyricope('ps 1-8')
     self.assertEqual('Psalm', pericope.book_name)
     self.assertEqual(150, pericope.book_chapter_count)
     self.assertTrue(pericope.book_has_chapters())
コード例 #5
0
ファイル: test.py プロジェクト: genebot/pyricope
 def test_max_verse(self):
     self.assertEqual(29, Pyricope.get_max_verse(1, 9))
     self.assertEqual(26, Pyricope.get_max_verse(1, 50))