def test_get_guilty_sequence_records(self): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") records, errors = docket.get_guilty_sequence_records() assert records[0]["judge"] == "Hill, Glynnis" assert records[0]["action_date"] == "09/09/2011" assert records[0]["charge"] == "Rape Forcible Compulsion" assert records[0]["max_length"] == convert_time("15","years") # A docket that does not have any guilty sequences to scrape docket = Docket("tests/texts/CP-51-CR-0000012-2011_stitched_complete.xml") records, errors = docket.get_guilty_sequence_records() assert len(records) == 0
def test_get_date_filed(self): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") assert docket.get_date_filed() == "01/03/2011" docket = Docket("tests/texts/CP-51-CR-0000012-2011_stitched_complete.xml") assert docket.get_date_filed() == "01/03/2011"
def test_get_docket_number(self): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") assert docket.get_docket_number() == "CP-51-CR-0000001-2011" docket = Docket("tests/texts/CP-51-CR-0000012-2011_stitched_complete.xml") assert docket.get_docket_number() == "CP-51-CR-0000012-2011"
def test_get_defendant_birthdate(self): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") assert docket.get_defendant_birthdate() == "07/24/1964" docket = Docket("tests/texts/CP-51-CR-0000012-2011_stitched_complete.xml") assert docket.get_defendant_birthdate() == "02/24/1983"
def test_get_defendant_name(self): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") assert docket.get_defendant_name() == "Samuel Mccray" docket = Docket("tests/texts/CP-51-CR-0000012-2011_stitched_complete.xml") assert docket.get_defendant_name() == "Sergio V V. Moore"
def test_write_guilty_sequence_records(): docket = Docket("tests/texts/CP-51-CR-0000001-2011_stitched_complete.xml") records, errors = docket.get_guilty_sequence_records() records, errors = write_guilty_sequence_records(records, "tests/output/single_test_records.csv", errors, "tests/output/single_test_errors.csv") assert len(records) == 3 assert len(errors) == 0