def test_do_not_consolidate_from_different_sections(self, make_response): client = FakeClient(responses=make_response) due_process_5 = client.read("/us/const/amendment/V") due_process_14 = client.read("/us/const/amendment/XIV") due_process_5.select( "life, liberty, or property, without due process of law") due_process_14.select( "life, liberty, or property, without due process of law") combined = EnactmentGroup(passages=[due_process_5, due_process_14]) assert len(combined) == 2
def test_consolidate_adjacent_passages(self, make_response): client = FakeClient(responses=make_response) copyright_clause = client.read("/us/const/article/I/8/8") copyright_statute = client.read("/us/usc/t17/s102/b") passage = copyright_clause.select(None) securing_for_authors = passage + ( "To promote the Progress of Science and " "useful Arts, by securing for limited Times to Authors") and_inventors = passage + "and Inventors" right_to_writings = passage + "the exclusive Right to their respective Writings" to_combine = [ copyright_statute, securing_for_authors, and_inventors, right_to_writings, ] combined = EnactmentGroup(passages=to_combine) assert len(combined) == 2 assert any( law.selected_text().startswith("To promote the Progress") and law.selected_text().endswith("their respective Writings…") for law in combined)
def test_text_interval_bad_selector(self, make_selector, make_response): client = FakeClient(responses=make_response) enactment = client.read("/us/const/amendment/IV") with pytest.raises(TextSelectionError): _ = enactment.convert_selection_to_set( make_selector["bad_selector"])