def test_format_psalms(self): self.assertEqual( format(ref('/scriptures/ot/ps'), book_format=FORMAT_LONG), 'Psalms') self.assertEqual( format(ref('/scriptures/ot/ps'), book_format=FORMAT_MEDIUM), 'Psalms') self.assertEqual( format(ref('/scriptures/ot/ps'), book_format=FORMAT_SHORT), 'Ps.') self.assertEqual( format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_LONG), 'Psalm 3') self.assertEqual( format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_MEDIUM), 'Psalm 3') self.assertEqual( format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_SHORT), 'Ps. 3') self.assertEqual( format( [ref('/scriptures/ot/ps/3.1'), ref('/scriptures/ot/ps/3.2-3')]), u'Psalm 3:1–3') self.assertEqual( format([ref('/scriptures/ot/ps/3'), ref('/scriptures/ot/ps/4')]), u'Psalm 3–4')
def test_single_chapter_book(self): self.assertEqual(format(ref('/scriptures/ot/obad/1')), 'Obadiah 1') self.assertEqual(format(ref('/scriptures/nt/jude/1')), 'Jude 1') self.assertEqual(format(ref('/scriptures/bofm/4-ne/1')), u'4\u00a0Nephi 1') self.assertEqual(format(ref('/scriptures/pgp/js-m/1')), u'Joseph Smith—Matthew 1')
def test_books(self): nt1 = ref('/scriptures/nt/matt') nt2 = ref('/scriptures/nt/mark/8') nt3 = ref('/scriptures/nt/luke') nt4 = ref('/scriptures/nt/john/3') nt5 = ref('/scriptures/nt/rev/11') self.assertEqual(sorted([ nt4, nt2, nt3, nt5, nt1 ]), [ nt1, nt2, nt3, nt4, nt5 ])
def test_verse_ranges(self): matt1 = ref('/scriptures/nt/matt/1.1,7-21') matt2 = ref('/scriptures/nt/matt/1.1-5') matt3 = ref('/scriptures/nt/matt/1.2,3-5') matt4 = ref('/scriptures/nt/matt/1.2-3,11-12,19-20') matt5 = ref('/scriptures/nt/matt/1.2-6,9') self.assertEqual(sorted([ matt4, matt2, matt3, matt5, matt1 ]), [ matt1, matt2, matt3, matt4, matt5 ])
def test_single_verse_ranges(self): matt1 = ref('/scriptures/nt/matt/1.1') matt2 = ref('/scriptures/nt/matt/1.1-5') matt3 = ref('/scriptures/nt/matt/1.2') matt4 = ref('/scriptures/nt/matt/1.2-3') matt5 = ref('/scriptures/nt/matt/1.2-6') self.assertEqual(sorted([ matt2, matt3, matt5, matt4, matt1 ]), [ matt1, matt2, matt3, matt4, matt5 ])
def test_chapters(self): matt1 = ref('/scriptures/nt/matt/1') matt2 = ref('/scriptures/nt/matt/4') matt3 = ref('/scriptures/nt/matt/7') matt4 = ref('/scriptures/nt/matt/8') matt5 = ref('/scriptures/nt/matt/17') self.assertEqual(sorted([ matt4, matt2, matt3, matt5, matt1 ]), [ matt1, matt2, matt3, matt4, matt5 ])
def test_format_psalms(self): self.assertEqual(format(ref('/scriptures/ot/ps'), book_format=FORMAT_LONG), 'Psalms') self.assertEqual(format(ref('/scriptures/ot/ps'), book_format=FORMAT_MEDIUM), 'Psalms') self.assertEqual(format(ref('/scriptures/ot/ps'), book_format=FORMAT_SHORT), 'Ps.') self.assertEqual(format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_LONG), 'Psalm 3') self.assertEqual(format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_MEDIUM), 'Psalm 3') self.assertEqual(format(ref('/scriptures/ot/ps/3'), book_format=FORMAT_SHORT), 'Ps. 3') self.assertEqual(format([ref('/scriptures/ot/ps/3.1'), ref('/scriptures/ot/ps/3.2-3')]), u'Psalm 3:1–3') self.assertEqual(format([ref('/scriptures/ot/ps/3'), ref('/scriptures/ot/ps/4')]), u'Psalm 3–4')
def test_format_a_of_f_variations(self): self.assertEqual( format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_LONG), 'Articles of Faith 1') self.assertEqual( format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_MEDIUM), 'Articles of Faith 1') self.assertEqual( format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_SHORT), 'A of F 1')
def test_format_js_h_variations(self): self.assertEqual( format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_LONG), u'Joseph Smith\u2014History 1') self.assertEqual( format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_MEDIUM), u'JS\u2014H 1') self.assertEqual( format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_SHORT), u'JS\u2014H 1')
def test_format_invalid_verses(self): self.assertEqual( format(ref('/scriptures/bofm/1-ne/1.21', validate_verses=False)), u'1\u00a0Nephi 1:21') self.assertEqual( format(ref('/scriptures/bofm/1-ne/1.20-21', validate_verses=False)), u'1\u00a0Nephi 1:20–21') self.assertEqual( format(ref('/scriptures/bofm/1-ne/1.20,21', validate_verses=False)), u'1\u00a0Nephi 1:20, 21')
def test_format_w_of_m_variations(self): self.assertEqual( format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_LONG), 'Words of Mormon 1') self.assertEqual( format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_MEDIUM), 'Words of Mormon 1') self.assertEqual( format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_SHORT), 'W of M 1')
def test_format_od(self): self.assertEqual( format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_LONG), 'Official Declarations') self.assertEqual( format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_MEDIUM), 'OD') self.assertEqual( format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_SHORT), 'OD') self.assertEqual( format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_LONG), u'Official Declaration—1') self.assertEqual( format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_MEDIUM), u'OD—1') self.assertEqual( format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_SHORT), u'OD—1') self.assertEqual( format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_LONG), u'Official Declaration—2') self.assertEqual( format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_MEDIUM), u'OD—2') self.assertEqual( format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_SHORT), u'OD—2')
def test_format_multiple_refs_in_chapter(self): self.assertEqual( format([ ref('/scriptures/ot/gen/40.1'), ref('/scriptures/ot/gen/40.1-5') ]), u'Genesis 40:1–5') self.assertEqual( format([ ref('/scriptures/ot/gen/40.1'), ref('/scriptures/ot/gen/40.3-5') ]), u'Genesis 40:1, 3–5')
def test_format_od(self): self.assertEqual(format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_LONG), 'Official Declarations') self.assertEqual(format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_MEDIUM), 'OD') self.assertEqual(format(ref('/scriptures/dc-testament/od'), book_format=FORMAT_SHORT), 'OD') self.assertEqual(format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_LONG), u'Official Declaration—1') self.assertEqual(format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_MEDIUM), u'OD—1') self.assertEqual(format(ref('/scriptures/dc-testament/od/1'), book_format=FORMAT_SHORT), u'OD—1') self.assertEqual(format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_LONG), u'Official Declaration—2') self.assertEqual(format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_MEDIUM), u'OD—2') self.assertEqual(format(ref('/scriptures/dc-testament/od/2'), book_format=FORMAT_SHORT), u'OD—2')
def test_merged(self): self.assertEqual(merged([ ref('/scriptures/ot/gen/1.1-4'), ref('/scriptures/ot/gen/2.3-4,6'), ref('/scriptures/ot/gen/2.5'), ref('/scriptures/ot/gen/3.1-7'), ref('/scriptures/ot/gen/3.9-11'), ref('/scriptures/ot/gen/3.13-14'), ref('/scriptures/ot/gen/3.12-16'), ]), [ ref('/scriptures/ot/gen/1.1-4'), ref('/scriptures/ot/gen/2.3-6'), ref('/scriptures/ot/gen/3.1-7,9-16'), ])
def test_format_closure(self): def formatter_test(label, ref): return '<a href="%s">%s</a>' % (ref.uri(), label) self.assertEqual( format([ ref('/scriptures/ot/gen/39.1'), ref('/scriptures/ot/ex/10.1-5') ], formatter=formatter_test), u'<a href="/scriptures/ot/gen/39.1">Genesis 39:1</a>; <a href="/scriptures/ot/ex/10.1-5">Exodus 10:1–5</a>' ) self.assertEqual( format(ref('/scriptures/ot/gen/39.1'), formatter=formatter_test), u'<a href="/scriptures/ot/gen/39.1">Genesis 39:1</a>')
def test_merged(self): self.assertEqual( merged([ ref('/scriptures/ot/gen/1.1-4'), ref('/scriptures/ot/gen/2.3-4,6'), ref('/scriptures/ot/gen/2.5'), ref('/scriptures/ot/gen/3.1-7'), ref('/scriptures/ot/gen/3.9-11'), ref('/scriptures/ot/gen/3.13-14'), ref('/scriptures/ot/gen/3.12-16'), ]), [ ref('/scriptures/ot/gen/1.1-4'), ref('/scriptures/ot/gen/2.3-6'), ref('/scriptures/ot/gen/3.1-7,9-16'), ])
def test_format_general(self): self.assertEqual(format(ref('/scriptures/ot/gen/40')), 'Genesis 40') self.assertEqual(format(ref('/scriptures/ot/gen/40.1')), 'Genesis 40:1') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3')), u'Genesis 40:1–3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3')), 'Genesis 40:1, 3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3-5')), u'Genesis 40:1, 3–5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5')), u'Genesis 40:1–3, 5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5-10')), u'Genesis 40:1–3, 5–10')
def test_format_general(self): def formatter_test(label, ref): return '<a href="%s">%s</a>' % (ref.uri(), label) self.assertEqual(format(ref('/scriptures/ot/gen/40')), 'Genesis 40') self.assertEqual(format(ref('/scriptures/ot/gen/40.1')), 'Genesis 40:1') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3')), u'Genesis 40:1–3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3')), 'Genesis 40:1, 3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3-5')), u'Genesis 40:1, 3–5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5')), u'Genesis 40:1–3, 5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5-10')), u'Genesis 40:1–3, 5–10') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5-10'), formatter=formatter_test), u'<a href="/scriptures/ot/gen/40.1-3,5-10">Genesis 40:1–3, 5–10</a>')
def test_format_spa(self): self.assertEqual(format(ref('/scriptures/ot'), lang='spa'), u'Antiguo Testamento') self.assertEqual(format(ref('/scriptures/ot/isa/40'), lang='spa'), u'Isaías 40') self.assertEqual(format(ref('/scriptures/nt/rev/11'), lang='spa'), u'Apocalipsis 11') self.assertEqual(format(ref('/scriptures/bofm/2-ne/5'), lang='spa'), u'2\u00a0Nefi 5') self.assertEqual(format(ref('/scriptures/dc-testament/dc/110'), lang='spa'), u'Doctrina y Convenios 110') self.assertEqual(format(ref('/scriptures/pgp/moses/2'), lang='spa'), u'Moisés 2')
def test_completely_invalid(self): with self.assertRaises(TypeError): scriptures.ref(None) with self.assertRaises(ValueError): scriptures.ref('') with self.assertRaises(ValueError): scriptures.ref('/something')
def test_merge_with_and_without_chapter(self): self.assertEqual( ref('/scriptures/ot/gen/1').merged(ref('/scriptures/ot/gen/1.5')), ref('/scriptures/ot/gen/1')) self.assertEqual( ref('/scriptures/ot/gen/1.5').merged(ref('/scriptures/ot/gen/1')), ref('/scriptures/ot/gen/1'))
def test_verses(self): self.assertEqual(len(ref('/scriptures/ot/gen/2.3').chapters()), 0) self.assertEqual(len(ref('/scriptures/ot/gen/2.1-25').chapters()), 1) self.assertEqual(len(ref('/scriptures/ot/gen/2.1-2,3,4-25').chapters()), 1) self.assertEqual(len(ref('/scriptures/ot/gen/2.3').verses()), 1) self.assertEqual(len(ref('/scriptures/ot/gen/2.2-9').verses()), 8) self.assertEqual(len(ref('/scriptures/ot/gen/2.2-9,14,17-18').verses()), 11)
def test_format_dc_variations(self): self.assertEqual(format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_LONG), 'Doctrine and Covenants') self.assertEqual(format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_MEDIUM), 'D&C') self.assertEqual(format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_SHORT), 'D&C') self.assertEqual(format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_LONG), 'Doctrine and Covenants 110') self.assertEqual(format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_MEDIUM), 'D&C 110') self.assertEqual(format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_SHORT), 'D&C 110')
def test_format_eng(self): self.assertEqual(format(ref('/scriptures/ot')), 'Old Testament') self.assertEqual(format(ref('/scriptures/ot/isa/40')), 'Isaiah 40') self.assertEqual(format(ref('/scriptures/nt/rev/11')), 'Revelation 11') self.assertEqual(format(ref('/scriptures/bofm/2-ne/5')), u'2\u00a0Nephi 5') self.assertEqual(format(ref('/scriptures/dc-testament/dc/110')), 'Doctrine and Covenants 110') self.assertEqual(format(ref('/scriptures/pgp/moses/2')), 'Moses 2')
def test_verses(self): self.assertEqual(len(ref('/scriptures/ot/gen/2.3').chapters()), 0) self.assertEqual(len(ref('/scriptures/ot/gen/2.1-25').chapters()), 1) self.assertEqual( len(ref('/scriptures/ot/gen/2.1-2,3,4-25').chapters()), 1) self.assertEqual(len(ref('/scriptures/ot/gen/2.3').verses()), 1) self.assertEqual(len(ref('/scriptures/ot/gen/2.2-9').verses()), 8) self.assertEqual( len(ref('/scriptures/ot/gen/2.2-9,14,17-18').verses()), 11)
def test_testaments(self): ot1 = ref('/scriptures/ot/gen') nt1 = ref('/scriptures/nt/matt/7') nt2 = ref('/scriptures/nt/mark/11') bofm1 = ref('/scriptures/bofm/1-ne') dc1 = ref('/scriptures/dc-testament/dc/108') pgp1 = ref('/scriptures/pgp/moses') self.assertEqual(sorted([ nt1, ot1, bofm1, pgp1, dc1, nt2 ]), [ ot1, nt1, nt2, bofm1, dc1, pgp1 ])
def test_format_multiple_refs_across_books(self): self.assertEqual( format([ ref('/scriptures/ot/gen/39.1'), ref('/scriptures/ot/ex/10.1-5') ]), u'Genesis 39:1; Exodus 10:1–5') self.assertEqual( format([ ref('/scriptures/ot/gen/39'), ref('/scriptures/ot/ex/40.3-5') ]), u'Genesis 39; Exodus 40:3–5') self.assertEqual( format([ ref('/scriptures/ot/gen/39'), ref('/scriptures/ot/ex/21'), ref('/scriptures/ot/ex/22') ]), u'Genesis 39; Exodus 21–22') self.assertEqual( format( [ref('/scriptures/ot/gen/39'), ref('/scriptures/ot/ex/21-22')]), u'Genesis 39; Exodus 21–22')
def test_format_spa(self): self.assertEqual(format(ref('/scriptures/ot'), lang='spa'), u'Antiguo Testamento') self.assertEqual(format(ref('/scriptures/ot/isa/40'), lang='spa'), u'Isaías 40') self.assertEqual(format(ref('/scriptures/nt/rev/11'), lang='spa'), u'Apocalipsis 11') self.assertEqual(format(ref('/scriptures/bofm/2-ne/5'), lang='spa'), u'2\u00a0Nefi 5') self.assertEqual( format(ref('/scriptures/dc-testament/dc/110'), lang='spa'), u'Doctrina y Convenios 110') self.assertEqual(format(ref('/scriptures/pgp/moses/2'), lang='spa'), u'Moisés 2')
def test_format_general(self): def formatter_test(label, ref): return '<a href="%s">%s</a>' % (ref.uri(), label) self.assertEqual(format(ref('/scriptures/ot/gen/40')), 'Genesis 40') self.assertEqual(format(ref('/scriptures/ot/gen/40.1')), 'Genesis 40:1') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3')), u'Genesis 40:1–3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3')), 'Genesis 40:1, 3') self.assertEqual(format(ref('/scriptures/ot/gen/40.1,3-5')), u'Genesis 40:1, 3–5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5')), u'Genesis 40:1–3, 5') self.assertEqual(format(ref('/scriptures/ot/gen/40.1-3,5-10')), u'Genesis 40:1–3, 5–10') self.assertEqual( format(ref('/scriptures/ot/gen/40.1-3,5-10'), formatter=formatter_test), u'<a href="/scriptures/ot/gen/40.1-3,5-10">Genesis 40:1–3, 5–10</a>' )
def test_format_dc_variations(self): self.assertEqual( format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_LONG), 'Doctrine and Covenants') self.assertEqual( format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_MEDIUM), 'D&C') self.assertEqual( format(ref('/scriptures/dc-testament/dc'), book_format=FORMAT_SHORT), 'D&C') self.assertEqual( format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_LONG), 'Doctrine and Covenants 110') self.assertEqual( format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_MEDIUM), 'D&C 110') self.assertEqual( format(ref('/scriptures/dc-testament/dc/110'), book_format=FORMAT_SHORT), 'D&C 110')
def test_chapter_ranges_with_lang(self): uri = '/scriptures/bofm/alma/56-57' website_url = 'https://www.lds.org/scriptures/bofm/alma/56-57?lang=spa' self.assertEqual( scriptures.ref(uri).website_url(lang='spa'), website_url)
def test_single_verse_range_with_first(self): uri = '/scriptures/ot/isa/40.1-4' website_url = 'https://www.lds.org/scriptures/ot/isa/40.1-4#primary' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_parentheticals_with_lang(self): uri = '/scriptures/dc-testament/dc/76.56-57(50-70)' website_url = 'https://www.lds.org/scriptures/dc-testament/dc/76.56-57(50-70)?lang=spa#55' self.assertEqual( scriptures.ref(uri).website_url(lang='spa'), website_url)
def test_chapter_ranges(self): uri = '/scriptures/bofm/alma/56-57' website_url = 'https://www.lds.org/scriptures/bofm/alma/56-57' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_format_w_of_m_variations(self): self.assertEqual(format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_LONG), 'Words of Mormon 1') self.assertEqual(format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_MEDIUM), 'Words of Mormon 1') self.assertEqual(format(ref('/scriptures/bofm/w-of-m/1'), book_format=FORMAT_SHORT), 'W of M 1')
def test_parentheticals(self): uri = '/scriptures/dc-testament/dc/76.56-57(50-70)' website_url = 'https://www.lds.org/scriptures/dc-testament/dc/76.56-57(50-70)#55' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_discontiguous_single_verses(self): uri = '/scriptures/ot/isa/40.2,4' website_url = 'https://www.lds.org/scriptures/ot/isa/40.2,4#1' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_single_verse_with_lang(self): uri = '/scriptures/ot/isa/40.2' website_url = 'https://www.lds.org/scriptures/ot/isa/40.2?lang=spa#1' self.assertEqual(scriptures.ref(uri).website_url(lang='spa'), website_url)
def test_discontiguous_verse_range_and_verse_with_first(self): uri = '/scriptures/ot/isa/40.1-4,6' website_url = 'https://www.lds.org/scriptures/ot/isa/40.1-4,6#primary' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_format_a_of_f_variations(self): self.assertEqual(format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_LONG), 'Articles of Faith 1') self.assertEqual(format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_MEDIUM), 'Articles of Faith 1') self.assertEqual(format(ref('/scriptures/pgp/a-of-f/1'), book_format=FORMAT_SHORT), 'A of F 1')
def test_format_js_h_variations(self): self.assertEqual(format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_LONG), u'Joseph Smith\u2014History 1') self.assertEqual(format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_MEDIUM), u'JS\u2014H 1') self.assertEqual(format(ref('/scriptures/pgp/js-h/1'), book_format=FORMAT_SHORT), u'JS\u2014H 1')
def test_no_verses(self): uri = '/scriptures/ot/isa/40' website_url = 'https://www.lds.org/scriptures/ot/isa/40' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_format_multiple_refs_in_chapter(self): self.assertEqual(format([ref('/scriptures/ot/gen/40.1'), ref('/scriptures/ot/gen/40.1-5')]), u'Genesis 40:1–5') self.assertEqual(format([ref('/scriptures/ot/gen/40.1'), ref('/scriptures/ot/gen/40.3-5')]), u'Genesis 40:1, 3–5')
def test_single_verse_range(self): uri = '/scriptures/ot/isa/40.2-4' website_url = 'https://www.lds.org/scriptures/ot/isa/40.2-4#1' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_single_verse_with_lang(self): uri = '/scriptures/ot/isa/40.2' website_url = 'https://www.lds.org/scriptures/ot/isa/40.2?lang=spa#1' self.assertEqual( scriptures.ref(uri).website_url(lang='spa'), website_url)
def test_discontiguous_verse_ranges(self): uri = '/scriptures/ot/isa/40.2-4,6-7,10' website_url = 'https://www.lds.org/scriptures/ot/isa/40.2-4,6-7,10#1' self.assertEqual(scriptures.ref(uri).website_url(), website_url)
def test_parentheticals_with_lang(self): uri = '/scriptures/dc-testament/dc/76.56-57(50-70)' website_url = 'https://www.lds.org/scriptures/dc-testament/dc/76.56-57(50-70)?lang=spa#55' self.assertEqual(scriptures.ref(uri).website_url(lang='spa'), website_url)
def test_chapter_ranges_with_lang(self): uri = '/scriptures/bofm/alma/56-57' website_url = 'https://www.lds.org/scriptures/bofm/alma/56-57?lang=spa' self.assertEqual(scriptures.ref(uri).website_url(lang='spa'), website_url)