Ejemplo n.º 1
0
    async def test_get_passage(self, config, bible2, mock_client_session):
        manager = ServiceManager.from_config(config, mock_client_session)
        manager.service_map['ServiceTwo'].get_passage.return_value = Passage(
            'blah', VerseRange.from_string('Genesis 1:2'))

        result = await manager.get_passage(
            bible2, VerseRange.from_string('Genesis 1:2'))

        assert result == Passage('blah', VerseRange.from_string('Genesis 1:2'),
                                 'BIB2')
        manager.service_map['ServiceTwo'].get_passage.assert_called_once_with(
            bible2, VerseRange.from_string('Genesis 1:2'))
Ejemplo n.º 2
0
    def test_init(self) -> None:
        verse_start = Verse(1, 1)
        verse_end = Verse(1, 4)

        passage = VerseRange('John', verse_start, verse_end)

        assert passage.book == 'John'
        assert passage.start == verse_start
        assert passage.end == verse_end

        passage = VerseRange('John', verse_start)
        assert passage.book == 'John'
        assert passage.start == verse_start
        assert passage.end is None
Ejemplo n.º 3
0
    def test_from_string(self, passage_str: str, expected: str | None) -> None:
        if expected is None:
            expected = passage_str

        passage = VerseRange.from_string(passage_str)
        assert passage is not None
        assert str(passage) == expected
Ejemplo n.º 4
0
    def test_init(self) -> None:
        text = 'foo bar baz'
        range = VerseRange('Exodus', Verse(1, 1))
        passage = Passage(text, range)

        assert passage.text == text
        assert passage.range == range
        assert passage.version is None
Ejemplo n.º 5
0
 async def test_get_passage_no_passages(
     self,
     service: Service,
     bible: Bible,
 ) -> None:
     with pytest.raises(DoNotUnderstandError):
         await service.get_passage(bible,
                                   VerseRange.from_string('John 50:1-4'))
Ejemplo n.º 6
0
    async def test_get_passage(self, mocker, MyService, bible, mock_response,
                               mock_client_session):
        expected = mocker.MagicMock()
        passage = mocker.MagicMock()
        passage.__aenter__.return_value = expected

        service = MyService(config={}, session=mock_client_session)
        service._request_passage.return_value = passage
        verses = VerseRange.from_string('Leviticus 1:2-3')

        result = await service.get_passage(bible, verses)

        assert result is expected
Ejemplo n.º 7
0
    async def test_get_passage(
        self,
        config: Any,
        bible2: Bible,
        service_one: MockService,
        service_two: MockService,
    ) -> None:
        manager = ServiceManager({
            'ServiceOne': service_one,
            'ServiceTwo': service_two
        })
        service_one.get_passage.return_value = Passage(
            'blah', VerseRange.from_string('Genesis 2:2'))
        service_two.get_passage.return_value = Passage(
            'blah', VerseRange.from_string('Genesis 1:2'))

        result = await manager.get_passage(
            bible2, VerseRange.from_string('Genesis 1:2'))

        assert result == Passage('blah', VerseRange.from_string('Genesis 1:2'),
                                 'BIB2')
        service_two.get_passage.assert_called_once_with(
            bible2, VerseRange.from_string('Genesis 1:2'))
Ejemplo n.º 8
0
    async def test_get_passage_timeout(
        self,
        bible1: Bible,
        service_one: MockService,
        service_two: MockService,
    ) -> None:
        async def get_passage(*args: Any, **kwargs: Any) -> None:
            await asyncio.sleep(0.5)

        manager = ServiceManager(
            {
                'ServiceOne': service_one,
                'ServiceTwo': service_two
            },
            timeout=0.1)
        service_one.get_passage.side_effect = get_passage

        with pytest.raises(ServiceLookupTimeout) as exc_info:
            await manager.get_passage(bible1,
                                      VerseRange.from_string('Genesis 1:2'))

        assert exc_info.value.bible == bible1
        assert exc_info.value.verses == VerseRange.from_string('Genesis 1:2')
Ejemplo n.º 9
0
    def test_get_all_from_string_optional(
        self, passage_str: str, only_bracketed: bool, expected: list[list[VerseRange]]
    ) -> None:
        passages = VerseRange.get_all_from_string(
            passage_str, only_bracketed=only_bracketed
        )
        assert passages is not None

        index: int
        if only_bracketed:
            index = 1
        else:
            index = 0

        assert passages == expected[index]
Ejemplo n.º 10
0
class TestVerseRange(object):
    def test_init(self) -> None:
        verse_start = Verse(1, 1)
        verse_end = Verse(1, 4)

        passage = VerseRange('John', verse_start, verse_end)

        assert passage.book == 'John'
        assert passage.start == verse_start
        assert passage.end == verse_end

        passage = VerseRange('John', verse_start)
        assert passage.book == 'John'
        assert passage.start == verse_start
        assert passage.end is None

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (VerseRange('John', Verse(1, 1)), 'John 1:1'),
            (VerseRange('John', Verse(1, 1), Verse(1, 4)), 'John 1:1-4'),
            (VerseRange('John', Verse(1, 1), Verse(2, 2)), 'John 1:1-2:2'),
        ],
    )
    def test__str__(self, passage: VerseRange, expected: str) -> None:
        assert str(passage) == expected

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (VerseRange('John', Verse(1, 1)), None),
            (VerseRange('John', Verse(1, 1)), VerseRange('John', Verse(1, 1))),
            (
                VerseRange('John', Verse(1, 1), Verse(2, 1)),
                VerseRange('John', Verse(1, 1), Verse(2, 1)),
            ),
            (
                VerseRange('John', Verse(1, 1), Verse(2, 1), 'sbl'),
                VerseRange('John', Verse(1, 1), Verse(2, 1), 'sbl'),
            ),
        ],
    )
    def test__eq__(self, passage: VerseRange, expected: VerseRange | None) -> None:
        assert passage == (expected or passage)

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (VerseRange('John', Verse(1, 1)), {}),
            (VerseRange('John', Verse(1, 1)), VerseRange('John', Verse(1, 2))),
            (
                VerseRange('John', Verse(1, 1), Verse(2, 1)),
                VerseRange('John', Verse(1, 1), Verse(3, 1)),
            ),
            (
                VerseRange('John', Verse(1, 1), Verse(2, 1), 'sbl'),
                VerseRange('John', Verse(1, 1), Verse(2, 1), 'niv'),
            ),
        ],
    )
    def test__ne__(self, passage: VerseRange, expected: Any) -> None:
        assert passage != expected

    @pytest.mark.parametrize(
        'passage_str,expected',
        [
            ('1 John 1:1', None),
            ('Mark 2:1-4', None),
            ('Acts 3:5-6:7', None),
            ('Mark 2:1\u20134', 'Mark 2:1-4'),
            ('Mark 2:1\u20144', 'Mark 2:1-4'),
            ('1 Pet. 3:1', '1 Peter 3:1'),
            ('1Pet. 3:1 - 4', '1 Peter 3:1-4'),
            ('1Pet. 3:1- 4', '1 Peter 3:1-4'),
            ('1Pet 3:1 - 4:5', '1 Peter 3:1-4:5'),
            ('Isa   54:2   - 23', 'Isaiah 54:2-23'),
            ('1 Pet. 3 : 1', '1 Peter 3:1'),
            ('1Pet. 3 : 1 - 4', '1 Peter 3:1-4'),
            ('1Pet. 3 : 1- 4', '1 Peter 3:1-4'),
            ('1Pet 3 : 1 - 4 : 5', '1 Peter 3:1-4:5'),
            ('Isa   54 : 2   - 23', 'Isaiah 54:2-23'),
        ],
    )
    def test_from_string(self, passage_str: str, expected: str | None) -> None:
        if expected is None:
            expected = passage_str

        passage = VerseRange.from_string(passage_str)
        assert passage is not None
        assert str(passage) == expected

    @pytest.mark.parametrize(
        'passage_str,expected',
        [
            ('foo 1 John 1:1 bar', [[VerseRange('1 John', Verse(1, 1))], []]),
            (
                'foo 1 John 1:1 bar Mark 2:1-4 baz',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                    ],
                    [],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark 2:1-4 baz Acts 3:5-6:7',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark 2:1\u20134 baz Acts 3:5-6:7',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark 2:1\u20144 baz Acts 3:5-6:7',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark    2 : 1   -     4 baz [Acts 3:5-6:7]',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [VerseRange('Acts', Verse(3, 5), Verse(6, 7))],
                ],
            ),
            (
                'foo 1 John 1:1 bar [Mark 2:1-4 KJV] baz Acts 3:5-6:7 blah',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4), 'KJV'),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [VerseRange('Mark', Verse(2, 1), Verse(2, 4), 'KJV')],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark 2:1-4 KJV baz [Acts 3:5-6:7 sbl123] blah',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7), 'sbl123'),
                    ],
                    [VerseRange('Acts', Verse(3, 5), Verse(6, 7), 'sbl123')],
                ],
            ),
            (
                'foo 1 John 1:1 bar Mark 2:1-4 KJV baz [Acts 3:5-6:7 sbl 123] blah',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4)),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [],
                ],
            ),
            (
                'foo [ 1 John 1:1 ] bar [Mark 2:1-4 KJV ] baz [Acts 3:5-6:7 sbl 123 ] '
                'blah',
                [
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4), 'KJV'),
                        VerseRange('Acts', Verse(3, 5), Verse(6, 7)),
                    ],
                    [
                        VerseRange('1 John', Verse(1, 1)),
                        VerseRange('Mark', Verse(2, 1), Verse(2, 4), 'KJV'),
                    ],
                ],
            ),
            # ('foo 1 John 1:1 bar', {'brackets': True}, []),
            # ('foo [1 John 1:1] bar', {'brackets': True}, ['1 John 1:1']),
            # ('foo 1 John 1:1 bar [Mark 2:1-4] baz', {'brackets': True}, ['Mark 2:1-4']),  # noqa
            # (
            #     'foo [1 John 1:1] bar [Mark 2:1-4] baz',
            #     {'brackets': True},
            #     ['1 John 1:1', 'Mark 2:1-4'],
            # ),
            # (
            #     'foo [1 John 1:1] bar Mark 2:1-4 baz [Acts 3:5-6:7]',
            #     {'brackets': True},
            #     ['1 John 1:1', 'Acts 3:5-6:7'],
            # ),
            # (
            #     'foo [1 John 1:1] bar [Mark 2:1-4] baz [Acts 3:5-6:7]',
            #     {'brackets': True},
            #     ['1 John 1:1', 'Mark 2:1-4', 'Acts 3:5-6:7'],
            # ),
        ],
    )
    @pytest.mark.parametrize('only_bracketed', [False, True])
    def test_get_all_from_string_optional(
        self, passage_str: str, only_bracketed: bool, expected: list[list[VerseRange]]
    ) -> None:
        passages = VerseRange.get_all_from_string(
            passage_str, only_bracketed=only_bracketed
        )
        assert passages is not None

        index: int
        if only_bracketed:
            index = 1
        else:
            index = 0

        assert passages == expected[index]

    @pytest.mark.parametrize(
        'passage_str', ['asdfc083u4r', 'Gen 1', 'Gen 1:', 'Gen 1:1 -', 'Gen 1:1 - 2:']
    )
    def test_from_string_raises(self, passage_str: str) -> None:
        with pytest.raises(ReferenceNotUnderstoodError):
            VerseRange.from_string(passage_str)
Ejemplo n.º 11
0
    def test_init(self) -> None:
        verses = [Passage('asdf', VerseRange('Exodus', Verse(1, 1)))]
        results = SearchResults(verses, 20)

        assert results.verses == verses
        assert results.total == 20
Ejemplo n.º 12
0
class TestSearchResults(object):
    def test_init(self) -> None:
        verses = [Passage('asdf', VerseRange('Exodus', Verse(1, 1)))]
        results = SearchResults(verses, 20)

        assert results.verses == verses
        assert results.total == 20

    @pytest.mark.parametrize(
        'results,expected',
        [
            (
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
                None,
            ),
            (
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
            ),
        ],
    )
    def test__eq__(
        self, results: SearchResults, expected: SearchResults | None
    ) -> None:
        assert results == (expected or results)

    @pytest.mark.parametrize(
        'results,expected',
        [
            (
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
                {},
            ),
            (
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 30
                ),
            ),
            (
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-3'))], 20
                ),
                SearchResults(
                    [Passage('asdf', VerseRange.from_string('Genesis 1:2-4'))], 20
                ),
            ),
        ],
    )
    def test__ne__(self, results: SearchResults, expected: Any) -> None:
        assert results != expected
Ejemplo n.º 13
0
class TestApiBible(ServiceTest):
    @pytest.fixture(
        params=[
            {
                'terms': ['Melchizedek'],
                'verses': [
                    Passage(
                        text=
                        'And Melchizedek king of Salem brought forth bread and '
                        'wine: and he was the priest of the most high God.',
                        range=VerseRange.from_string('Genesis 14:18'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'The LORD hath sworn, and will not repent, Thou art a '
                        'priest for ever after the order of Melchizedek.',
                        range=VerseRange.from_string('Psalm 110:4'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'As he saith also in another place , Thou art a priest '
                        'for ever after the order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 5:6'),
                        version='KJV',
                    ),
                    Passage(
                        text='Called of God an high priest after the order of '
                        'Melchisedec.',
                        range=VerseRange.from_string('Hebrews 5:10'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Whither the forerunner is for us entered, even Jesus, '
                        'made an high priest for ever after the order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 6:20'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'For this Melchisedec, king of Salem, priest of the most '
                        'high God, who met Abraham returning from the slaughter of the '
                        'kings, and blessed him;',
                        range=VerseRange.from_string('Hebrews 7:1'),
                        version='KJV',
                    ),
                    Passage(
                        text='For he was yet in the loins of his father, when '
                        'Melchisedec met him.',
                        range=VerseRange.from_string('Hebrews 7:10'),
                        version='KJV',
                    ),
                    Passage(
                        text='If therefore perfection were by the Levitical '
                        'priesthood, (for under it the people received the law,) what '
                        'further need was there that another priest should rise after '
                        'the order of Melchisedec, and not be called after the order '
                        'of Aaron?',
                        range=VerseRange.from_string('Hebrews 7:11'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And it is yet far more evident: for that after the '
                        'similitude of Melchisedec there ariseth another priest,',
                        range=VerseRange.from_string('Hebrews 7:15'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'For he testifieth, Thou art a priest for ever after the '
                        'order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 7:17'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        '(For those priests were made without an oath; but this '
                        'with an oath by him that said unto him, The Lord sware and '
                        'will not repent, Thou art a priest for ever after the order '
                        'of Melchisedec:)',
                        range=VerseRange.from_string('Hebrews 7:21'),
                        version='KJV',
                    ),
                ],
                'total':
                11,
            },
            {
                'terms': ['faith'],
                'verses': [
                    Passage(
                        text=
                        'And he said, I will hide my face from them, I will see '
                        'what their end shall be: for they are a very froward '
                        'generation, children in whom is no faith.',
                        range=VerseRange.from_string('Deuteronomy 32:20'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Behold, his soul which is lifted up is not upright in '
                        'him: but the just shall live by his faith.',
                        range=VerseRange.from_string('Habakkuk 2:4'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Wherefore, if God so clothe the grass of the field, '
                        'which to day is, and to morrow is cast into the oven, shall '
                        'he not much more clothe you, O ye of little faith?',
                        range=VerseRange.from_string('Matthew 6:30'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'When Jesus heard it , he marvelled, and said to them '
                        'that followed, Verily I say unto you, I have not found so '
                        'great faith, no, not in Israel.',
                        range=VerseRange.from_string('Matthew 8:10'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And he saith unto them, Why are ye fearful, O ye of '
                        'little faith? Then he arose, and rebuked the winds and the '
                        'sea; and there was a great calm.',
                        range=VerseRange.from_string('Matthew 8:26'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And, behold, they brought to him a man sick of the '
                        'palsy, lying on a bed: and Jesus seeing their faith said unto '
                        'the sick of the palsy; Son, be of good cheer; thy sins be '
                        'forgiven thee.',
                        range=VerseRange.from_string('Matthew 9:2'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'But Jesus turned him about, and when he saw her, he '
                        'said, Daughter, be of good comfort; thy faith hath made thee '
                        'whole. And the woman was made whole from that hour.',
                        range=VerseRange.from_string('Matthew 9:22'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Then touched he their eyes, saying, According to your '
                        'faith be it unto you.',
                        range=VerseRange.from_string('Matthew 9:29'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And immediately Jesus stretched forth his hand, and '
                        'caught him, and said unto him, O thou of little faith, '
                        'wherefore didst thou doubt?',
                        range=VerseRange.from_string('Matthew 14:31'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Then Jesus answered and said unto her, O woman, great is '
                        'thy faith: be it unto thee even as thou wilt. And her '
                        'daughter was made whole from that very hour.',
                        range=VerseRange.from_string('Matthew 15:28'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Which when Jesus perceived, he said unto them, O ye of '
                        'little faith, why reason ye among yourselves, because ye have '
                        'brought no bread?',
                        range=VerseRange.from_string('Matthew 16:8'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And Jesus said unto them, Because of your unbelief: for '
                        'verily I say unto you, If ye have faith as a grain of mustard '
                        'seed, ye shall say unto this mountain, Remove hence to yonder '
                        'place; and it shall remove; and nothing shall be impossible '
                        'unto you.',
                        range=VerseRange.from_string('Matthew 17:20'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Jesus answered and said unto them, Verily I say unto '
                        'you, If ye have faith, and doubt not, ye shall not only do '
                        'this which is done to the fig tree, but also if ye shall say '
                        'unto this mountain, Be thou removed, and be thou cast into '
                        'the sea; it shall be done.',
                        range=VerseRange.from_string('Matthew 21:21'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'Woe unto you, scribes and Pharisees, hypocrites! for ye '
                        'pay tithe of mint and anise and cummin, and have omitted the '
                        'weightier matters of the law, judgment, mercy, and faith: '
                        'these ought ye to have done, and not to leave the other '
                        'undone.',
                        range=VerseRange.from_string('Matthew 23:23'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'When Jesus saw their faith, he said unto the sick of the '
                        'palsy, Son, thy sins be forgiven thee.',
                        range=VerseRange.from_string('Mark 2:5'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And he said unto them, Why are ye so fearful? how is it '
                        'that ye have no faith?',
                        range=VerseRange.from_string('Mark 4:40'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And he said unto her, Daughter, thy faith hath made '
                        'thee whole; go in peace, and be whole of thy plague.',
                        range=VerseRange.from_string('Mark 5:34'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And Jesus said unto him, Go thy way; thy faith hath '
                        'made thee whole. And immediately he received his sight, and '
                        'followed Jesus in the way.',
                        range=VerseRange.from_string('Mark 10:52'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And Jesus answering saith unto them, Have faith in God.',
                        range=VerseRange.from_string('Mark 11:22'),
                        version='KJV',
                    ),
                    Passage(
                        text=
                        'And when he saw their faith, he said unto him, Man, thy '
                        'sins are forgiven thee.',
                        range=VerseRange.from_string('Luke 5:20'),
                        version='KJV',
                    ),
                ],
                'total':
                231,
            },
            {
                'terms': ['antidisestablishmentarianism'],
                'verses': [],
                'total': 0
            },
        ],
        ids=['Melchizedek', 'faith', 'antidisestablishmentarianism'],
    )
    def search_data(self, request):
        return request.param

    @pytest.fixture(
        params=[
            {
                'verse':
                VerseRange.from_string('Gal 3:10-11'),
                'passage':
                Passage(
                    '**10.** For as many as are of the works of the law are under the '
                    'curse: for it is written, Cursed _is_ every one that continueth '
                    'not in all things which are written in the book of the law to do '
                    'them. **11.** But that no man is justified by the law in the '
                    'sight of God, _it is_ evident: for, The just shall live by faith.',
                    VerseRange.from_string('Gal 3:10-11'),
                    'KJV',
                ),
            },
            {
                'verse':
                VerseRange.from_string('Mark 5:1'),
                'passage':
                Passage(
                    '**1.** And they came over unto the other side of the sea, into '
                    'the country of the Gadarenes.',
                    VerseRange.from_string('Mark 5:1'),
                    'KJV',
                ),
            },
        ],
        ids=['Gal 3:10-11 KJV', 'Mark 5:1 KJV'],
    )
    def passage_data(self, request):
        return request.param

    @pytest.fixture(scope="class")
    def config(self):
        try:
            config = toml.load(
                str(
                    Path(__file__).resolve().parent.parent.parent /
                    'config.toml'))
            return config['bot']['services']['ApiBible']
        except FileNotFoundError:
            return {'api_key': ''}

    @pytest.fixture
    def default_version(self):
        return 'de4e12af7f28f599-02'

    @pytest.fixture
    def default_abbr(self):
        return 'KJV'

    @pytest.fixture
    def service(self, config, session):
        return ApiBible(config=config, session=session)
Ejemplo n.º 14
0
        'botus_receptus.utils.send_embed',
        return_value=mocker.sentinel.send_embed_return,
    )


@pytest.mark.parametrize(
    'passage,kwargs,description,footer,ephemeral',
    [
        (
            Passage(
                '**10.** For as many as are of the works of the law are under the '
                'curse: for it is written, Cursed _is_ every one that continueth '
                'not in all things which are written in the book of the law to do '
                'them. **11.** But that no man is justified by the law in the '
                'sight of God, _it is_ evident: for, The just shall live by faith.',
                VerseRange.from_string('Gal 3:10-11'),
                'KJV',
            ),
            {},
            '**10.** For as many as are of the works of the law are under the '
            'curse: for it is written, Cursed _is_ every one that continueth '
            'not in all things which are written in the book of the law to do '
            'them. **11.** But that no man is justified by the law in the '
            'sight of God, _it is_ evident: for, The just shall live by faith.',
            'Galatians 3:10-11 (KJV)',
            discord.utils.MISSING,
        ),
        (
            Passage(
                'a' * 4096,
                VerseRange.from_string('Gen 3:10-11'),
Ejemplo n.º 15
0
class TestApiBible(ServiceTest):
    @pytest.fixture(
        params=[
            {
                'terms': ['Melchizedek'],
                'verses': [
                    Passage(
                        text='And Melchizedek king of Salem brought forth bread and '
                        'wine: and he was the priest of the most high God.',
                        range=VerseRange.from_string('Genesis 14:18'),
                        version='KJV',
                    ),
                    Passage(
                        text='The LORD hath sworn, and will not repent, Thou art a '
                        'priest for ever after the order of Melchizedek.',
                        range=VerseRange.from_string('Psalm 110:4'),
                        version='KJV',
                    ),
                    Passage(
                        text='As he saith also in another place, Thou art a priest '
                        'for ever after the order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 5:6'),
                        version='KJV',
                    ),
                    Passage(
                        text='Called of God an high priest after the order of '
                        'Melchisedec.',
                        range=VerseRange.from_string('Hebrews 5:10'),
                        version='KJV',
                    ),
                    Passage(
                        text='Whither the forerunner is for us entered, even Jesus, '
                        'made an high priest for ever after the order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 6:20'),
                        version='KJV',
                    ),
                    Passage(
                        text='For this Melchisedec, king of Salem, priest of the most '
                        'high God, who met Abraham returning from the slaughter of the '
                        'kings, and blessed him;',
                        range=VerseRange.from_string('Hebrews 7:1'),
                        version='KJV',
                    ),
                    Passage(
                        text='For he was yet in the loins of his father, when '
                        'Melchisedec met him.',
                        range=VerseRange.from_string('Hebrews 7:10'),
                        version='KJV',
                    ),
                    Passage(
                        text='If therefore perfection were by the Levitical '
                        'priesthood, (for under it the people received the law,) what '
                        'further need was there that another priest should rise after '
                        'the order of Melchisedec, and not be called after the order '
                        'of Aaron?',
                        range=VerseRange.from_string('Hebrews 7:11'),
                        version='KJV',
                    ),
                    Passage(
                        text='And it is yet far more evident: for that after the '
                        'similitude of Melchisedec there ariseth another priest,',
                        range=VerseRange.from_string('Hebrews 7:15'),
                        version='KJV',
                    ),
                    Passage(
                        text='For he testifieth, Thou art a priest for ever after the '
                        'order of Melchisedec.',
                        range=VerseRange.from_string('Hebrews 7:17'),
                        version='KJV',
                    ),
                    Passage(
                        text='(For those priests were made without an oath; but this '
                        'with an oath by him that said unto him, The Lord sware and '
                        'will not repent, Thou art a priest for ever after the order '
                        'of Melchisedec:)',
                        range=VerseRange.from_string('Hebrews 7:21'),
                        version='KJV',
                    ),
                ],
                'total': 11,
            },
            {
                'terms': ['faith'],
                'verses': [
                    Passage(
                        text='My servant Moses is not so, who is faithful in all mine '
                        'house.',
                        range=VerseRange.from_string('Numbers 12:7'),
                        version='KJV',
                    ),
                    Passage(
                        text='Know therefore that the LORD thy God, he is God, the '
                        'faithful God, which keepeth covenant and mercy with them that '
                        'love him and keep his commandments to a thousand generations;',
                        range=VerseRange.from_string('Deuteronomy 7:9'),
                        version='KJV',
                    ),
                    Passage(
                        text='And he said, I will hide my face from them, I will see '
                        'what their end shall be: for they are a very froward '
                        'generation, children in whom is no faith.',
                        range=VerseRange.from_string('Deuteronomy 32:20'),
                        version='KJV',
                    ),
                    Passage(
                        text='And I will raise me up a faithful priest, that shall do '
                        'according to that which is in mine heart and in my mind: '
                        'and I will build him a sure house; and he shall walk before '
                        'mine anointed for ever.',
                        range=VerseRange.from_string('1 Samuel 2:35'),
                        version='KJV',
                    ),
                    Passage(
                        text='Then Ahimelech answered the king, and said, And who is '
                        'so faithful among all thy servants as David, which is the '
                        'king\u2019s son in law, and goeth at thy bidding, and is '
                        'honourable in thine house?',
                        range=VerseRange.from_string('1 Samuel 22:14'),
                        version='KJV',
                    ),
                    Passage(
                        text='The LORD render to every man his righteousness and his '
                        'faithfulness: for the LORD delivered thee into my hand to '
                        'day, but I would not stretch forth mine hand against the '
                        'LORD\u2019s anointed.',
                        range=VerseRange.from_string('1 Samuel 26:23'),
                        version='KJV',
                    ),
                    Passage(
                        text='I am one of them that are peaceable and faithful in '
                        'Israel: thou seekest to destroy a city and a mother in '
                        'Israel: why wilt thou swallow up the inheritance of the '
                        'LORD ?',
                        range=VerseRange.from_string('2 Samuel 20:19'),
                        version='KJV',
                    ),
                    Passage(
                        text='That I gave my brother Hanani, and Hananiah the ruler '
                        'of the palace, charge over Jerusalem: for he was a faithful '
                        'man, and feared God above many.',
                        range=VerseRange.from_string('Nehemiah 7:2'),
                        version='KJV',
                    ),
                    Passage(
                        text='And foundest his heart faithful before thee, and madest '
                        'a covenant with him to give the land of the Canaanites, the '
                        'Hittites, the Amorites, and the Perizzites, and the '
                        'Jebusites, and the Girgashites, to give it, I say, to his '
                        'seed, and hast performed thy words; for thou art righteous:',
                        range=VerseRange.from_string('Nehemiah 9:8'),
                        version='KJV',
                    ),
                    Passage(
                        text='And I made treasurers over the treasuries, Shelemiah '
                        'the priest, and Zadok the scribe, and of the Levites, '
                        'Pedaiah: and next to them was Hanan the son of Zaccur, the '
                        'son of Mattaniah: for they were counted faithful, and their '
                        'office was to distribute unto their brethren.',
                        range=VerseRange.from_string('Nehemiah 13:13'),
                        version='KJV',
                    ),
                    Passage(
                        text='For there is no faithfulness in their mouth; their '
                        'inward part is very wickedness; their throat is an open '
                        'sepulchre; they flatter with their tongue.',
                        range=VerseRange.from_string('Psalm 5:9'),
                        version='KJV',
                    ),
                    Passage(
                        text='Help, LORD; for the godly man ceaseth; for the faithful '
                        'fail from among the children of men.',
                        range=VerseRange.from_string('Psalm 12:1'),
                        version='KJV',
                    ),
                    Passage(
                        text='O love the LORD, all ye his saints: for the LORD '
                        'preserveth the faithful, and plentifully rewardeth the proud '
                        'doer.',
                        range=VerseRange.from_string('Psalm 31:23'),
                        version='KJV',
                    ),
                    Passage(
                        text='Thy mercy, O LORD, is in the heavens; and thy '
                        'faithfulness reacheth unto the clouds.',
                        range=VerseRange.from_string('Psalm 36:5'),
                        version='KJV',
                    ),
                    Passage(
                        text='I have not hid thy righteousness within my heart; I '
                        'have declared thy faithfulness and thy salvation: I have not '
                        'concealed thy lovingkindness and thy truth from the great '
                        'congregation.',
                        range=VerseRange.from_string('Psalm 40:10'),
                        version='KJV',
                    ),
                    Passage(
                        text='Shall thy lovingkindness be declared in the grave? or '
                        'thy faithfulness in destruction?',
                        range=VerseRange.from_string('Psalm 88:11'),
                        version='KJV',
                    ),
                    Passage(
                        text='I will sing of the mercies of the LORD for ever: with '
                        'my mouth will I make known thy faithfulness to all '
                        'generations.',
                        range=VerseRange.from_string('Psalm 89:1'),
                        version='KJV',
                    ),
                    Passage(
                        text='For I have said, Mercy shall be built up for ever: thy '
                        'faithfulness shalt thou establish in the very heavens.',
                        range=VerseRange.from_string('Psalm 89:2'),
                        version='KJV',
                    ),
                    Passage(
                        text='And the heavens shall praise thy wonders, O LORD: thy '
                        'faithfulness also in the congregation of the saints.',
                        range=VerseRange.from_string('Psalm 89:5'),
                        version='KJV',
                    ),
                    Passage(
                        text='O LORD God of hosts, who is a strong LORD like unto '
                        'thee? or to thy faithfulness round about thee?',
                        range=VerseRange.from_string('Psalm 89:8'),
                        version='KJV',
                    ),
                ],
                'total': 328,
            },
            {'terms': ['antidisestablishmentarianism'], 'verses': [], 'total': 0},
        ],
        ids=['Melchizedek', 'faith', 'antidisestablishmentarianism'],
    )
    def search_data(self, request: _pytest.fixtures.SubRequest) -> dict[str, Any]:
        return cast(dict[str, Any], request.param)

    @pytest.fixture(
        params=[
            {
                'verse': VerseRange.from_string('Gal 3:10-11'),
                'passage': Passage(
                    '**10.** For as many as are of the works of the law are under the '
                    'curse: for it is written, Cursed _is_ every one that continueth '
                    'not in all things which are written in the book of the law to do '
                    'them. **11.** But that no man is justified by the law in the '
                    'sight of God, _it is_ evident: for, The just shall live by faith.',
                    VerseRange.from_string('Gal 3:10-11'),
                    'KJV',
                ),
            },
            {
                'verse': VerseRange.from_string('Mark 5:1'),
                'passage': Passage(
                    '**1.** And they came over unto the other side of the sea, into '
                    'the country of the Gadarenes.',
                    VerseRange.from_string('Mark 5:1'),
                    'KJV',
                ),
            },
        ],
        ids=['Gal 3:10-11 KJV', 'Mark 5:1 KJV'],
    )
    def passage_data(self, request: _pytest.fixtures.SubRequest) -> dict[str, Any]:
        return cast(dict[str, Any], request.param)

    @pytest.fixture(scope="class")
    def config(self) -> dict[str, str]:
        try:
            config = toml.load(
                str(Path(__file__).resolve().parent.parent.parent / 'config.toml')
            )
            return cast(dict[str, str], config['bot']['services']['ApiBible'])
        except FileNotFoundError:
            return {'api_key': ''}

    @pytest.fixture
    def default_version(self) -> str:
        return 'de4e12af7f28f599-02'

    @pytest.fixture
    def default_abbr(self) -> str:
        return 'KJV'

    @pytest.fixture
    def service(
        self, config: Any, aiohttp_client_session: aiohttp.ClientSession
    ) -> Service:
        return ApiBible(config=config, session=aiohttp_client_session)
Ejemplo n.º 16
0
class TestBiblesOrg(ServiceTest):
    @pytest.fixture(
        params=[
            {
                'terms': ['Melchizedek'],
                'verses': [
                    Passage(
                        text=
                        'And **Melchizedek** king of Salem brought out bread and '
                        'wine; now he was a priest of God Most High.',
                        range=VerseRange.from_string('Genesis 14:18'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'just as He says also in another passage, \u201cYOU ARE A '
                        'PRIEST FOREVER ACCORDING TOTHE ORDER OF **MELCHIZEDEK**.'
                        '\u201d',
                        range=VerseRange.from_string('Hebrews 5:6'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'being designated by God as a high priest according to '
                        'the order of **Melchizedek**.',
                        range=VerseRange.from_string('Hebrews 5:10'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'where Jesus has entered as a forerunner for us, having '
                        'become a high priest forever according to the order of '
                        '**Melchizedek**.',
                        range=VerseRange.from_string('Hebrews 6:20'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '**Melchizedek\u2019s** Priesthood Like Christ\u2019s '
                        'For this **Melchizedek**, king of Salem, priest of the Most '
                        'High God, who met Abraham as he was returning from the '
                        'slaughter of the kings and blessed him,',
                        range=VerseRange.from_string('Hebrews 7:1'),
                        version='NASB',
                    ),
                    Passage(
                        text='for he was still in the loins of his father when '
                        '**Melchizedek** met him.',
                        range=VerseRange.from_string('Hebrews 7:10'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'Now if perfection was through the Levitical priesthood '
                        '(for on the basis of it the people received the Law), what '
                        'further need was there for another priest to arise according '
                        'to the order of **Melchizedek**, and not be designated '
                        'according to the order of Aaron?',
                        range=VerseRange.from_string('Hebrews 7:11'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'And this is clearer still, if another priest arises '
                        'according to the likeness of **Melchizedek**,',
                        range=VerseRange.from_string('Hebrews 7:15'),
                        version='NASB',
                    ),
                    Passage(
                        text='For it is attested of Him, \u201cYOU ARE A PRIEST '
                        'FOREVER ACCORDING TO THE ORDER OF **MELCHIZEDEK**.\u201d',
                        range=VerseRange.from_string('Hebrews 7:17'),
                        version='NASB',
                    ),
                    Passage(
                        text='The LORD has sworn and will not change His mind, '
                        '\u201cYou are a priest forever According to the order of '
                        '**Melchizedek**.\u201d',
                        range=VerseRange.from_string('Psalm 110:4'),
                        version='NASB',
                    ),
                ],
                'total':
                10,
            },
            {
                'terms': ['faith'],
                'verses': [
                    Passage(
                        text=
                        '\u201cKnow therefore that the LORD your God, He is God, '
                        'the **faithful** God, who keeps His covenant and His '
                        'lovingkindness to a thousandth generation with those who love '
                        'Him and keep His commandments;',
                        range=VerseRange.from_string('Deuteronomy 7:9'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cThe Rock! His work is perfect, For all His ways '
                        'are just; A God of **faithfulness** and without injustice, '
                        'Righteous and upright is He.',
                        range=VerseRange.from_string('Deuteronomy 32:4'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cThen He said, \u2018I will hide My face from them, '
                        'I will see what their end shall be; For they are a perverse '
                        'generation, Sons in whom is no **faithfulness**.',
                        range=VerseRange.from_string('Deuteronomy 32:20'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'because you broke **faith** with Me in the midst of the '
                        'sons of Israel at the waters of Meribah-kadesh, in the '
                        'wilderness of Zin, because you did not treat Me as holy in '
                        'the midst of the sons of Israel.',
                        range=VerseRange.from_string('Deuteronomy 32:51'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'I am unworthy of all the lovingkindness and of all the '
                        '**faithfulness** which You have shown to Your servant; for '
                        'with my staff only I crossed this Jordan, and now I have '
                        'become two companies.',
                        range=VerseRange.from_string('Genesis 32:10'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'When the time for Israel to die drew near, he called his '
                        'son Joseph and said to him, \u201cPlease, if I have found '
                        'favor in your sight, place now your hand under my thigh and '
                        'deal with me in kindness and **faithfulness**. Please do not '
                        'bury me in Egypt,',
                        range=VerseRange.from_string('Genesis 47:29'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'So the men said to her, \u201cOur life for yours if you '
                        'do not tell this business of ours; and it shall come about '
                        'when the LORD gives us the land that we will deal kindly and '
                        '**faithfully** with you.\u201d The Promise to Rahab',
                        range=VerseRange.from_string('Joshua 2:14'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'Israel Is Defeated at Ai But the sons of Israel acted '
                        '**unfaithfully** in regard to the things under the ban, for '
                        'Achan, the son of Carmi, the son of Zabdi, the son of Zerah, '
                        'from the tribe of Judah, took some of the things under the '
                        'ban, therefore the anger of the LORD burned against the sons '
                        'of Israel.',
                        range=VerseRange.from_string('Joshua 7:1'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cThus says the whole congregation of the LORD, '
                        '\u2018What is this **unfaithful** act which you have '
                        'committed against the God of Israel, turning away from '
                        'following the LORD this day, by building yourselves an altar, '
                        'to rebel against the LORD this day?',
                        range=VerseRange.from_string('Joshua 22:16'),
                        version='NASB',
                    ),
                    Passage(
                        text='\u2018Did not Achan the son of Zerah act '
                        '**unfaithfully** in the things under the ban, and wrath fall '
                        'on all the congregation of Israel? And that man did not '
                        'perish alone in his iniquity.\u2019\u201d',
                        range=VerseRange.from_string('Joshua 22:20'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cThe Mighty One, God, the LORD, the Mighty One, '
                        'God, the LORD! He knows, and may Israel itself know. If it '
                        'was in rebellion, or if in an **unfaithful** act against the '
                        'LORD do not save us this day!',
                        range=VerseRange.from_string('Joshua 22:22'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        'And Phinehas the son of Eleazar the priest said to the '
                        'sons of Reuben and to the sons of Gad and to the sons of '
                        'Manasseh, \u201cToday we know that the LORD is in our midst, '
                        'because you have not committed this **unfaithful** act '
                        'against the LORD; now you have delivered the sons of Israel '
                        'from the hand of the LORD.\u201d',
                        range=VerseRange.from_string('Joshua 22:31'),
                        version='NASB',
                    ),
                    Passage(
                        text='\u201cIf a person acts **unfaithfully** and sins '
                        'unintentionally against the LORD\u2019S holy things, then he '
                        'shall bring his guilt offering to the LORD: a ram without '
                        'defect from the flock, according to your valuation in silver '
                        'by shekels, in terms of the shekel of the sanctuary, for a '
                        'guilt offering.',
                        range=VerseRange.from_string('Leviticus 5:15'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cWhen a person sins and acts **unfaithfully** '
                        'against the LORD, and deceives his companion in regard to a '
                        'deposit or a security entrusted to him, or through robbery, '
                        'or if he has extorted from his companion,',
                        range=VerseRange.from_string('Leviticus 6:2'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u2018If they confess their iniquity and the iniquity of '
                        'their forefathers, in their **unfaithfulness** which they '
                        'committed against Me, and also in their acting with hostility '
                        'against Me\u2014',
                        range=VerseRange.from_string('Leviticus 26:40'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cSpeak to the sons of Israel, \u2018When a man or '
                        'woman commits any of the sins of mankind, acting '
                        '**unfaithfully** against the LORD, and that person is guilty,',
                        range=VerseRange.from_string('Numbers 5:6'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cSpeak to the sons of Israel and say to them, '
                        '\u2018If any man\u2019s wife goes astray and is '
                        '**unfaithful** to him,',
                        range=VerseRange.from_string('Numbers 5:12'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u2018When he has made her drink the water, then it '
                        'shall come about, if she has defiled herself and has been '
                        '**unfaithful** to her husband, that the water which brings a '
                        'curse will go into her and cause bitterness, and her abdomen '
                        'will swell and her thigh will waste away, and the woman will '
                        'become a curse among her people.',
                        range=VerseRange.from_string('Numbers 5:27'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u201cNot so, with My servant Moses, He is **faithful** '
                        'in all My household;',
                        range=VerseRange.from_string('Numbers 12:7'),
                        version='NASB',
                    ),
                    Passage(
                        text=
                        '\u2018Your sons shall be shepherds for forty years in '
                        'the wilderness, and they will suffer for your '
                        '**unfaithfulness**, until your corpses lie in the wilderness.',
                        range=VerseRange.from_string('Numbers 14:33'),
                        version='NASB',
                    ),
                ],
                'total':
                417,
            },
            {
                'terms': ['antidisestablishmentarianism'],
                'verses': [],
                'total': 0
            },
        ],
        ids=['Melchizedek', 'faith', 'antidisestablishmentarianism'],
    )
    def search_data(self, request):
        return request.param

    @pytest.fixture(
        params=[
            {
                'verse':
                VerseRange.from_string('Gal 3:10-11'),
                'passage':
                Passage(Galatians_3_10_11,
                        VerseRange.from_string('Gal 3:10-11'), 'NASB'),
            },
            {
                'verse':
                VerseRange.from_string('Mark 5:1'),
                'passage':
                Passage(Mark_5_1, VerseRange.from_string('Mark 5:1'), 'NASB'),
            },
        ],
        ids=['Gal 3:10-11 NASB', 'Mark 5:1 NASB'],
    )
    def passage_data(self, request):
        return request.param

    @pytest.fixture(scope="class")
    def config(self):
        try:
            config = toml.load(
                str(
                    Path(__file__).resolve().parent.parent.parent /
                    'config.toml'))
            return config['bot']['services']['BiblesOrg']
        except FileNotFoundError:
            return {'api_key': ''}

    @pytest.fixture
    def default_version(self):
        return 'eng-NASB'

    @pytest.fixture
    def default_abbr(self):
        return 'NASB'

    @pytest.fixture
    def service(self, config, session):
        return BiblesOrg(config=config, session=session)
Ejemplo n.º 17
0
 def test_from_string_raises(self, passage_str: str) -> None:
     with pytest.raises(ReferenceNotUnderstoodError):
         VerseRange.from_string(passage_str)
Ejemplo n.º 18
0
class TestBibleGateway(ServiceTest):
    @pytest.fixture(
        params=[
            {
                'terms': ['Melchizedek'],
                'verses': [
                    Passage(
                        text=
                        'And **Melchizedek** king of Salem brought out bread and '
                        'wine; now he was a priest of God Most High.',
                        range=VerseRange.from_string('Genesis 14:18'),
                        version='NASB1995',
                    ),
                    Passage(
                        text='The LORD has sworn and will not change His mind, '
                        '\u201CYou are a priest forever According to the order of '
                        '**Melchizedek**.\u201D',
                        range=VerseRange.from_string('Psalm 110:4'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'just as He says also in another _passage_, \u201CYOU ARE '
                        'A PRIEST FOREVER ACCORDING TO THE ORDER OF **MELCHIZEDEK**.'
                        '\u201D',
                        range=VerseRange.from_string('Hebrews 5:6'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'being designated by God as a high priest according to '
                        'the order of **Melchizedek**.',
                        range=VerseRange.from_string('Hebrews 5:10'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'where Jesus has entered as a forerunner for us, having '
                        'become a high priest forever according to the order of '
                        '**Melchizedek**.',
                        range=VerseRange.from_string('Hebrews 6:20'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        '_**Melchizedek**\u2019s Priesthood Like Christ\u2019s_'
                        ' For this **Melchizedek**, king of Salem, priest of the '
                        'Most High God, who met Abraham as he was returning from the '
                        'slaughter of the kings and blessed him,',
                        range=VerseRange.from_string('Hebrews 7:1'),
                        version='NASB1995',
                    ),
                    Passage(
                        text='for he was still in the loins of his father when '
                        '**Melchizedek** met him.',
                        range=VerseRange.from_string('Hebrews 7:10'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Now if perfection was through the Levitical priesthood '
                        '(for on the basis of it the people received the Law), what '
                        'further need _was there_ for another priest to arise '
                        'according to the order of **Melchizedek**, and not be '
                        'designated according to the order of Aaron?',
                        range=VerseRange.from_string('Hebrews 7:11'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'And this is clearer still, if another priest arises '
                        'according to the likeness of **Melchizedek**,',
                        range=VerseRange.from_string('Hebrews 7:15'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'For it is attested _of Him_, \u201CYOU ARE A PRIEST '
                        'FOREVER ACCORDING TO THE ORDER OF **MELCHIZEDEK**.\u201D',
                        range=VerseRange.from_string('Hebrews 7:17'),
                        version='NASB1995',
                    ),
                ],
                'total':
                10,
            },
            {
                'terms': ['faith'],
                'verses': [
                    Passage(
                        text=
                        'I am unworthy of all the lovingkindness and of all '
                        'the **faith**fulness which You have shown to Your '
                        'servant; for with my staff _only_ I crossed this Jordan, '
                        'and now I have become two companies.',
                        range=VerseRange.from_string('Genesis 32:10'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'When the time for Israel to die drew near, he called his '
                        'son Joseph and said to him, \u201CPlease, if I have found '
                        'favor in your sight, place now your hand under my thigh and '
                        'deal with me in kindness and **faith**fulness. Please do not '
                        'bury me in Egypt,',
                        range=VerseRange.from_string('Genesis 47:29'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        '\u201CNot so, with My servant Moses, He is **faith**'
                        'ful in all My household;',
                        range=VerseRange.from_string('Numbers 12:7'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Know therefore that the LORD your God, He is God, the '
                        '**faith**ful God, who keeps His covenant and His '
                        'lovingkindness to a thousandth generation with those who love '
                        'Him and keep His commandments;',
                        range=VerseRange.from_string('Deuteronomy 7:9'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        '\u201CThe Rock! His work is perfect, For all His ways '
                        'are just; A God of **faith**fulness and without injustice, '
                        'Righteous and upright is He.',
                        range=VerseRange.from_string('Deuteronomy 32:4'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        '\u201CThen He said, \u2018I will hide My face from them, '
                        'I will see what their end _shall be_; For they are a perverse '
                        'generation, Sons in whom is no **faith**fulness.',
                        range=VerseRange.from_string('Deuteronomy 32:20'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'because you broke **faith** with Me in the midst of the '
                        'sons of Israel at the waters of Meribah-kadesh, in the '
                        'wilderness of Zin, because you did not treat Me as holy in '
                        'the midst of the sons of Israel.',
                        range=VerseRange.from_string('Deuteronomy 32:51'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'So the men said to her, \u201COur life for yours if you '
                        'do not tell this business of ours; and it shall come about '
                        'when the LORD gives us the land that we will deal kindly and '
                        '**faith**fully with you.\u201D',
                        range=VerseRange.from_string('Joshua 2:14'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'But I will raise up for Myself a **faith**ful priest who '
                        'will do according to what is in My heart and in My soul; and '
                        'I will build him an enduring house, and he will walk before '
                        'My anointed always.',
                        range=VerseRange.from_string('1 Samuel 2:35'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Then Ahimelech answered the king and said, \u201CAnd who '
                        'among all your servants is as **faith**ful as David, even the '
                        'king\u2019s son-in-law, who is captain over your guard, and '
                        'is honored in your house?',
                        range=VerseRange.from_string('1 Samuel 22:14'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'The LORD will repay each man _for_ his righteousness and '
                        'his **faith**fulness; for the LORD delivered you into _my_ '
                        'hand today, but I refused to stretch out my hand against the '
                        'LORD\u2019S anointed.',
                        range=VerseRange.from_string('1 Samuel 26:23'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'I am of those who are peaceable _and_ **faith**ful in '
                        'Israel. You are seeking to destroy a city, even a mother in '
                        'Israel. Why would you swallow up the inheritance of the '
                        'LORD?\u201D',
                        range=VerseRange.from_string('2 Samuel 20:19'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Moreover, they did not require an accounting from the '
                        'men into whose hand they gave the money to pay to those who '
                        'did the work, for they dealt **faith**fully.',
                        range=VerseRange.from_string('2 Kings 12:15'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Only no accounting shall be made with them for the money '
                        'delivered into their hands, for they deal **faith**fully.'
                        '\u201D',
                        range=VerseRange.from_string('2 Kings 22:7'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Then he charged them saying, \u201CThus you shall do in '
                        'the fear of the LORD, **faith**fully and wholeheartedly.',
                        range=VerseRange.from_string('2 Chronicles 19:9'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        '_**Faith**less Priests_ Now it came about after this '
                        'that Joash decided to restore the house of the LORD.',
                        range=VerseRange.from_string('2 Chronicles 24:4'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'They **faith**fully brought in the contributions and the '
                        'tithes and the consecrated things; and Conaniah the Levite '
                        '_was_ the officer in charge of them and his brother Shimei '
                        '_was_ second.',
                        range=VerseRange.from_string('2 Chronicles 31:12'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'Under his authority _were_ Eden, Miniamin, Jeshua, '
                        'Shemaiah, Amariah and Shecaniah in the cities of the priests, '
                        'to distribute **faith**fully _their portions_ to their '
                        'brothers by divisions, whether great or small,',
                        range=VerseRange.from_string('2 Chronicles 31:15'),
                        version='NASB1995',
                    ),
                    Passage(
                        text=
                        'The genealogical enrollment _included_ all their little '
                        'children, their wives, their sons and their daughters, for '
                        'the whole assembly, for they consecrated themselves '
                        '**faith**fully in holiness.',
                        range=VerseRange.from_string('2 Chronicles 31:18'),
                        version='NASB1995',
                    ),
                    Passage(
                        text='_Sennacherib Invades Judah_ After these acts of '
                        '**faith**fulness Sennacherib king of Assyria came and invaded '
                        'Judah and besieged the fortified cities, and thought to break '
                        'into them for himself.',
                        range=VerseRange.from_string('2 Chronicles 32:1'),
                        version='NASB1995',
                    ),
                ],
                'total':
                378,
            },
            {
                'terms': ['antidisestablishmentarianism'],
                'verses': [],
                'total': 0
            },
        ],
        ids=['Melchizedek', 'faith', 'antidisestablishmentarianism'],
    )
    def search_data(self,
                    request: _pytest.fixtures.SubRequest) -> dict[str, Any]:
        return cast(dict[str, Any], request.param)

    @pytest.fixture(
        params=[
            {
                'verse':
                VerseRange.from_string('Gal 3:10-11'),
                'passage':
                Passage(Galatians_3_10_11,
                        VerseRange.from_string('Gal 3:10-11'), 'NASB1995'),
            },
            {
                'verse':
                VerseRange.from_string('Mark 5:1'),
                'passage':
                Passage(Mark_5_1, VerseRange.from_string('Mark 5:1'),
                        'NASB1995'),
            },
            {
                'verse':
                VerseRange.from_string('Psalm 53:1'),
                'passage':
                Passage(Psalm_53_1_ESV, VerseRange.from_string('Psalm 53:1'),
                        'ESV'),
                'version':
                'ESV',
                'abbr':
                'ESV',
            },
        ],
        ids=['Gal 3:10-11 NASB1995', 'Mark 5:1 NASB1995', 'Psalm 53:1 ESV'],
    )
    def passage_data(self,
                     request: _pytest.fixtures.SubRequest) -> dict[str, Any]:
        return cast(dict[str, Any], request.param)

    @pytest.fixture
    def default_version(self) -> str:
        return 'NASB1995'

    @pytest.fixture
    def default_abbr(self) -> str:
        return 'NASB1995'

    @pytest.fixture
    def service(self,
                aiohttp_client_session: aiohttp.ClientSession) -> Service:
        return BibleGateway(config={}, session=aiohttp_client_session)
Ejemplo n.º 19
0
class TestPassage(object):
    def test_init(self) -> None:
        text = 'foo bar baz'
        range = VerseRange('Exodus', Verse(1, 1))
        passage = Passage(text, range)

        assert passage.text == text
        assert passage.range == range
        assert passage.version is None

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')),
                'foo bar baz\n\nGenesis 1:2-3',
            ),
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3'), 'KJV'),
                'foo bar baz\n\nGenesis 1:2-3 (KJV)',
            ),
        ],
    )
    def test__str__(self, passage: Passage, expected: str) -> None:
        assert str(passage) == expected

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')), None),
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')),
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')),
            ),
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3'), 'KJV'),
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3'), 'KJV'),
            ),
        ],
    )
    def test__eq__(self, passage: Passage, expected: Passage | None) -> None:
        assert passage == (expected or passage)

    @pytest.mark.parametrize(
        'passage,expected',
        [
            (Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')), {}),
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3')),
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-4')),
            ),
            (
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3'), 'ESV'),
                Passage('foo bar baz', VerseRange.from_string('Genesis 1:2-3'), 'KJV'),
            ),
        ],
    )
    def test__ne__(self, passage: Passage, expected: Any) -> None:
        assert passage != expected