コード例 #1
0
    def test_navigation(self):
        toc = [
            preamble.ToCPart(
                part='478',
                title='27',
                name='Commerce',
                authority_url='',
                sections=[
                    preamble.ToCSect(
                        full_id='2016_02749-cfr-478-99',
                        url='/preamble/2016_02749/cfr_changes/478-99',
                        title=u'§ 478.99 Certain prohibited',
                        part='478',
                        section='99',
                    ),
                    preamble.ToCSect(
                        full_id='2016_02749-cfr-478-120',
                        url='/preamble/2016_02749/cfr_changes/478-120',
                        title=u'§ 478.120 Firearms',
                        part='478',
                        section='120',
                    ),
                ],
            )
        ]

        nav = preamble.section_navigation([], toc, part='478', section='99')
        assert_equal(nav['next'].section_id, '2016_02749-cfr-478-120')
        assert_equal(nav['previous'].markup_prefix, '27 CFR 478')

        nav = preamble.section_navigation([], toc, part='478', section='120')
        assert_equal(nav['previous'].section_id, '2016_02749-cfr-478-99')
        assert_is_none(nav['next'])
コード例 #2
0
    def test_navigation(self):
        toc = [
            preamble.ToCPart(
                part='478',
                title='27',
                name='Commerce',
                authority_url='',
                sections=[
                    preamble.ToCSect(
                        full_id='2016_02749-cfr-478-99',
                        url='/preamble/2016_02749/cfr_changes/478-99',
                        title=u'§ 478.99 Certain prohibited',
                        part='478', section='99',
                    ),
                    preamble.ToCSect(
                        full_id='2016_02749-cfr-478-120',
                        url='/preamble/2016_02749/cfr_changes/478-120',
                        title=u'§ 478.120 Firearms',
                        part='478', section='120',
                    ),
                ],
            )
        ]

        nav = preamble.section_navigation([], toc, part='478', section='99')
        assert_equal(nav['next'].section_id, '2016_02749-cfr-478-120')
        assert_equal(nav['previous'].markup_prefix, '27 CFR 478')

        nav = preamble.section_navigation([], toc, part='478', section='120')
        assert_equal(nav['previous'].section_id, '2016_02749-cfr-478-99')
        assert_is_none(nav['next'])
コード例 #3
0
    def test_navigation(self):
        toc = preamble.make_preamble_toc(self.nodes)

        nav = preamble.section_navigation(toc, [],
                                          full_id='doc_id-preamble-doc_id-I')
        assert_equal(nav['next'].section_id, 'doc_id-preamble-doc_id-II')
        assert_is_none(nav['previous'])

        nav = preamble.section_navigation(toc, [],
                                          full_id='doc_id-preamble-doc_id-II')
        assert_equal(nav['previous'].section_id, 'doc_id-preamble-doc_id-I')
        assert_is_none(nav['next'])
コード例 #4
0
    def test_navigation(self):
        toc = preamble.make_preamble_toc(self.nodes)

        nav = preamble.section_navigation(
            toc, [], full_id='doc_id-preamble-doc_id-I')
        assert_equal(nav['next'].section_id, 'doc_id-preamble-doc_id-II')
        assert_is_none(nav['previous'])

        nav = preamble.section_navigation(
            toc, [], full_id='doc_id-preamble-doc_id-II')
        assert_equal(nav['previous'].section_id, 'doc_id-preamble-doc_id-I')
        assert_is_none(nav['next'])