def test_add_prev_next(self): view = PartialSearch() context = {"results": {"total_hits": 77}} view.add_prev_next(0, context) self.assertFalse("previous" in context) self.assertEqual(context["next"], {"page": 1, "length": 10}) del context["next"] view.add_prev_next(5, context) self.assertEqual(context["previous"], {"page": 4, "length": 10}) self.assertEqual(context["next"], {"page": 6, "length": 10}) del context["previous"] del context["next"] view.add_prev_next(6, context) self.assertEqual(context["previous"], {"page": 5, "length": 10}) self.assertEqual(context["next"], {"page": 7, "length": 7}) del context["previous"] del context["next"] view.add_prev_next(7, context) self.assertEqual(context["previous"], {"page": 6, "length": 10}) self.assertFalse("next" in context)
def test_add_prev_next(self): view = PartialSearch() context = {'results': {'total_hits': 77}} view.add_prev_next(0, context) self.assertFalse('previous' in context) self.assertEqual(context['next'], {'page': 1, 'length': 10}) del context['next'] view.add_prev_next(5, context) self.assertEqual(context['previous'], {'page': 4, 'length': 10}) self.assertEqual(context['next'], {'page': 6, 'length': 10}) del context['previous'] del context['next'] view.add_prev_next(6, context) self.assertEqual(context['previous'], {'page': 5, 'length': 10}) self.assertEqual(context['next'], {'page': 7, 'length': 7}) del context['previous'] del context['next'] view.add_prev_next(7, context) self.assertEqual(context['previous'], {'page': 6, 'length': 10}) self.assertFalse('next' in context)
version_switch_view='chrome_paragraph_view')), name='chrome_paragraph_view'), # A regulation landing page # Example: http://.../201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern), SideBarView.as_view(), name='sidebar'), # Load just search results url(r'^partial/search(?:/cfr)?/%s$' % reg_pattern, PartialSearch.as_view(), name='partial_search', kwargs={'doc_type': 'cfr'}), url(r'^partial/search/preamble/%s$' % preamble_pattern, PartialSearch.as_view(), name='partial_search', kwargs={'doc_type': 'preamble'}), # A diff view of a section (without chrome) url(r'^partial/diff/%s/%s/%s$' % ( section_pattern, version_pattern, newer_version_pattern), lt_cache(PartialSectionDiffView.as_view()), name='partial_section_diff_view'), # A section by section paragraph (without chrome) # Example: http://.../partial/sxs/201-2-g/2011-1738 url(r'^partial/sxs/%s/%s$' % (paragraph_pattern, notice_pattern), lt_cache(ParagraphSXSView.as_view()), name='paragraph_sxs_view'),
lt_cache(ChromeParagraphView.as_view()), name='chrome_paragraph_view'), #A regulation landing page #Example: http://.../201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern), SideBarView.as_view(), name='sidebar'), # Load just search results url(r'^partial/search/%s$' % reg_pattern, PartialSearch.as_view(), name='partial_search'), #A diff view of a section (without chrome) url(r'^partial/diff/%s/%s/%s$' % ( section_pattern, version_pattern, newer_version_pattern), lt_cache(PartialSectionDiffView.as_view()), name='partial_section_diff_view'), #A section by section paragraph (without chrome) #Example: http://.../partial/sxs/201-2-g/2011-1738 url(r'^partial/sxs/%s/%s$' % (paragraph_pattern, notice_pattern), lt_cache(ParagraphSXSView.as_view()), name='paragraph_sxs_view'), #A definition templated to be displayed in the sidebar (without chrome) #Example: http://.../partial/definition/201-2-g/2011-1738 url(r'^partial/definition/%s/%s$' % (paragraph_pattern, version_pattern),
name='chrome_paragraph_view'), #A regulation landing page #Example: http://.../201 url(r'^%s$' % reg_pattern, ChromeLandingView.as_view(), name='regulation_landing_view'), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r'^partial/sidebar/%s/%s$' % (paragraph_pattern, version_pattern), SideBarView.as_view(), name='sidebar'), # Load just search results url(r'^partial/search/%s$' % reg_pattern, PartialSearch.as_view(), name='partial_search'), #A diff view of a section (without chrome) url(r'^partial/diff/%s/%s/%s$' % (section_pattern, version_pattern, newer_version_pattern), lt_cache(PartialSectionDiffView.as_view()), name='partial_section_diff_view'), #A section by section paragraph (without chrome) #Example: http://.../partial/sxs/201-2-g/2011-1738 url(r'^partial/sxs/%s/%s$' % (paragraph_pattern, notice_pattern), lt_cache(ParagraphSXSView.as_view()), name='paragraph_sxs_view'), #A definition templated to be displayed in the sidebar (without chrome) #Example: http://.../partial/definition/201-2-g/2011-1738 url(r'^partial/definition/%s/%s$' % (paragraph_pattern, version_pattern),
# Example: http://.../regulation/201-4-Interp/2013-10704 url(r"^%s/%s$" % (interp_pattern, version_pattern), ChromeInterpView.as_view(), name="chrome_interp_view"), # The whole regulation with chrome # Example: http://.../regulation/201/2013-10704 url(r"^%s/%s$" % (reg_pattern, version_pattern), ChromeRegulationView.as_view(), name="chrome_regulation_view"), # A regulation paragraph with chrome # Example: http://.../regulation/201-2-g/2013-10704 url(r"^%s/%s$" % (paragraph_pattern, version_pattern), ChromeParagraphView.as_view(), name="chrome_paragraph_view"), # A regulation landing page # Example: http://.../regulation/201 url(r"^%s$" % reg_pattern, ChromeLandingView.as_view(), name="regulation_landing_view"), # Load just the sidebar # Example: http://.../partial/sidebar/201-2/2013-10704 url(r"^partial/sidebar/%s/%s$" % (paragraph_pattern, version_pattern), SideBarView.as_view(), name="sidebar"), # Load just search results url(r"^partial/search/%s$" % reg_pattern, PartialSearch.as_view(), name="partial_search"), # A diff view of a section (without chrome) url( r"^partial/diff/%s/%s/%s$" % (section_pattern, version_pattern, newer_version_pattern), PartialSectionDiffView.as_view(), name="partial_section_diff_view", ), # A section by section paragraph (without chrome) # Example: http://.../partial/sxs/201-2-g/2011-1738 url( r"^partial/sxs/%s/%s$" % (paragraph_pattern, notice_pattern), ParagraphSXSView.as_view(), name="paragraph_sxs_view", ), # A definition templated to be displayed in the sidebar (without chrome) # Example: http://.../partial/definition/201-2-g/2011-1738