def test_section_text_from_path_and_regime(self, make_regime):
     copyright_exceptions = readers.read_enactment(
         {"source": "/us/usc/t17/s102/b"}, regime=make_regime
     )
     assert copyright_exceptions.text.startswith(
         "In no case does copyright protection "
         + "for an original work of authorship extend to any"
     )
 def test_make_enactment_from_dict_with_code_and_regime(
     self, make_regime, make_code
 ):
     fourth_a = readers.read_enactment(
         record={"source": "/us/const/amendment-IV"},
         code=make_code["const"],
         regime=make_regime,
     )
     assert fourth_a.text.endswith("and the persons or things to be seized.")
 def test_make_enactment_from_dict_with_text_split(self, make_regime, make_code):
     fourth_a = readers.read_enactment(
         record={
             "source": "/us/const/amendment-IV",
             "text": "and|the persons or things|to be seized.",
         },
         code=make_code["const"],
         regime=make_regime,
     )
     assert fourth_a.selector.exact.endswith("or things")
 def test_exact_text_not_in_selection(self, make_regime):
     due_process_wrong_section = TextQuoteSelector(exact="due process")
     with pytest.raises(ValueError):
         _ = readers.read_enactment(
             {
                 "selector": due_process_wrong_section,
                 "source": "/us/const/amendment-XV/1",
             },
             regime=make_regime,
         )
 def test_short_passage_from_uslm_code(self, make_code):
     """Also tests adding the missing initial "/" in ``path``."""
     usc17 = make_code["usc17"]
     method = readers.read_enactment(
         {
             "source": "us/usc/t17/s102/b",
             "prefix": "process, system,",
             "suffix": ", concept, principle",
         },
         code=usc17,
     )
     assert method.text.strip() == "method of operation"
    def test_supply_missing_source_from_code(self, make_code):
        """
        Test that when a "source" path is omitted, the load method
        at least uses the uri of the code as the source.

        It might make sense for the method to find a more accurate
        source path for the specific section, but it doesn't.
        """
        const = make_code["const"]
        due_process = readers.read_enactment(
            {"prefix": "property, without ", "suffix": "nor shall private property"},
            code=const,
        )
        assert "due process" in due_process.text
        assert due_process.source.startswith("/us/const")
    def test_date_and_text_from_path_and_regime(self, make_regime):
        """
        This tests different parsing code because the date is
        in the format "dated the 25th of September, 1804"

        This also verifies that providing the ``regime`` to the
        Enactment constructor is sufficient to assign the full text of
        the section as the text of the Enactment, even though no
        ``exact``, ``prefix``, ``suffix``, or ``source`` parameter was
        passed to the TextQuoteSelector constructor.
        """
        amendment_12 = readers.read_enactment(
            {"source": "/us/const/amendment-XII"}, regime=make_regime
        )
        assert amendment_12.effective_date == datetime.date(1804, 9, 25)
        assert "Electors shall meet" in amendment_12.text
Ejemplo n.º 8
0
 def test_enactment_from_dict(self, make_regime):
     enactment = readers.read_enactment(self.test_enactments[0],
                                        regime=make_regime)
     assert "all relevant evidence is admissible" in enactment.text
 def test_cite_entire_constitution(self, make_regime):
     entire_const = readers.read_enactment(
         {"source": "/us/const"}, regime=make_regime
     )
     assert "and been seven Years a Citizen" in entire_const.text
 def test_passage_from_cfr_code(self, make_code):
     cfr = make_code["cfr37"]
     slogans = readers.read_enactment({"source": "/us/cfr/t37/s202.1"}, code=cfr)
     assert "Words and short phrases such as names" in slogans.text
 def test_chapeau_and_subsections_from_uslm_code(self, make_code):
     beard = make_code["beard_act"]
     definition = readers.read_enactment(
         {"source": "/au/act/1934/47/1/4"}, code=beard,
     )
     assert definition.text.strip().endswith("below the nose.")
 def test_add_omitted_initial_slash(self, make_code):
     usc17 = make_code["usc17"]
     statute = readers.read_enactment(
         {"exact": "process, system,", "source": "us/usc/t17/s102/b/"}, code=usc17
     )
     assert statute.source.startswith("/")
 def test_omit_terminal_slash(self, make_code):
     usc17 = make_code["usc17"]
     statute = readers.read_enactment(
         {"exact": "process, system,", "source": "us/usc/t17/s102/b/"}, code=usc17
     )
     assert not statute.source.endswith("/")
 def test_round_trip_dict(self, make_code):
     cfr = make_code["cfr37"]
     slogans = readers.read_enactment({"source": "/us/cfr/t37/s202.1"}, code=cfr)
     dumped_slogans = dump.to_dict(slogans)
     new = readers.read_enactment(dumped_slogans, code=cfr)
     assert new.source == "/us/cfr/t37/s202.1"
 def test_dump_json(self, make_code):
     cfr = make_code["cfr37"]
     slogans = readers.read_enactment({"source": "/us/cfr/t37/s202.1"}, code=cfr)
     s = dump.to_json(slogans)
     assert '"source": "/us/cfr/t37/s202.1"' in s
 def test_constitution_effective_date(self, make_regime):
     ex_post_facto_provision = readers.read_enactment(
         {"source": "/us/const/article-I/9/3"}, regime=make_regime
     )
     assert ex_post_facto_provision.effective_date == datetime.date(1788, 9, 13)