示例#1
0
 def test_load_enactment_with_nested_cross_reference(self):
     data = {
         "heading":
         "Waiver of beard tax in special circumstances",
         "content":
         "",
         "start_date":
         "1935-04-01",
         "node":
         "/test/acts/47/6D",
         "children": [{
             "heading":
             "",
             "content":
             "The Department of Beards shall waive the collection of beard tax upon issuance of beardcoin under Section 6C where the reason the maintainer wears a beard is due to bona fide religious, cultural, or medical reasons.",
             "start_date":
             "2013-07-18",
             "node":
             "/test/acts/47/6D/1",
             "children": [],
             "end_date":
             None,
             "url":
             "http://127.0.0.1:8000/api/v1/test/acts/47/6D/1@2020-01-01",
             "citations": [{
                 "target_uri": "/test/acts/47/6C",
                 "target_url":
                 "http://127.0.0.1:8000/api/v1/test/acts/47/6C@2020-01-01",
                 "target_node": 1660695,
                 "reference_text": "Section 6C",
             }],
         }],
         "end_date":
         None,
         "url":
         "http://127.0.0.1:8000/api/v1/test/acts/47/6D@2020-01-01",
         "citations": [],
         "parent":
         "http://127.0.0.1:8000/api/v1/test/acts/47@2020-01-01",
     }
     schema = EnactmentSchema(many=False)
     enactment = schema.load(data)
     refs = enactment.children[0]._cross_references
     assert len(refs) == 1
示例#2
0
 def test_cannot_select_text_with_citation(self, section_11_subdivided):
     schema = EnactmentSchema()
     section = schema.load(section_11_subdivided)
     cite = section.as_citation()
     with pytest.raises(TypeError):
         section.select_more(cite)
示例#3
0
 def test_select_text_with_string(self, fourth_a):
     schema = EnactmentSchema()
     fourth_a = schema.load(fourth_a)
     fourth_a.select("The right of the people")
     assert fourth_a.selected_text() == "The right of the people…"
示例#4
0
 def test_select_with_position_selector(self, section_11_together):
     schema = EnactmentSchema()
     section = schema.load(section_11_together)
     section.select(TextPositionSelector(start=29, end=43))
     assert section.selected_text() == "…issue licenses…"
示例#5
0
 def test_select_all_nested(self, section_11_subdivided):
     """Clear selected text, and then select one subsection."""
     schema = EnactmentSchema()
     combined = schema.load(section_11_subdivided)
     combined.select()
     assert combined.selected_text().startswith("The Department of Beards")
示例#6
0
 def test_select_none_with_None(self, section_11_subdivided):
     schema = EnactmentSchema()
     combined = schema.load(section_11_subdivided)
     combined.select(None)
     assert combined.selected_text() == ""
示例#7
0
 def test_load_nested_enactment(self, section6d):
     schema = EnactmentSchema()
     result = schema.load(section6d)
     assert result.heading.startswith("Waiver")