Ejemplo n.º 1
0
 def validate_mass_string_parse(self, strings, site_id):
     """Non-test method"""
     if site_id not in ["mass", "massappct"]:
         self.fail(
             "You provided an invalid site string to validate_mass_string_parse: %s"
             % site_id
         )
     site = mass.Site() if site_id == "mass" else massappct.Site()
     for raw_string, parsed in strings.items():
         # Set year on site scraper
         site.year = int(raw_string.split(" ")[-1].rstrip(")"))
         site.set_local_variables()
         try:
             # make sure name is parsed
             self.assertEqual(
                 site.grouping_regex.search(raw_string).group(1).strip(),
                 parsed[0],
             )
             # make sure docket is parsed
             self.assertEqual(
                 site.grouping_regex.search(raw_string).group(2).strip(),
                 parsed[1],
             )
         except AttributeError:
             self.fail(
                 "Unable to parse %s string: '%s'" % (site_id, raw_string)
             )
Ejemplo n.º 2
0
    def test_massappct(self):
        strings = (
            'Commonwealth v. Forbes (AC 13-P-730) (August 26, 2014)',
            'Commonwealth v. Malick (AC 09-P-1292, 11-P-0973) (August 25, 2014)',
            'Litchfield\'s Case (AC 13-P-1044) (August 28, 2014)',
            'Rose v. Highway Equipment Company (AC 13-P-1215) (August 27, 2014)',
            'Commonwealth v. Alves (AC 13-P-1183) (August 27, 2014)',
            'Commonwealth v. Forbes (AC 13-P-730) (August 26, 2014)',
            'Commonwealth v. Malick (AC 09-P-1292, 11-P-0973) (August 25, 2014)',
            'Commonwealth v. Dale (AC 12-P-1909) (August 25, 2014)',
            'Kewley v. Department of Elementary and Secondary Education (AC 13-P-0833) (August 22, 2014)',
            'Hazel\'s Cup & Saucer, LLC v. Around The Globe Travel, Inc. (AC 13-P-1371) (August 22, 2014)',
            'Becker v. Phelps (AC 13-P-0951) (August 22, 2014)',
            'Barrow v. Dartmouth House Nursing Home, Inc. (AC 13-P-1375) (August 18, 2014)',
            'Zimmerling v. Affinity Financial Corp. (AC 13-P-1439) (August 18, 2014)',
            'Lowell v. Talcott (AC 13-P-1053) (August 18, 2014)',
        )

        site = massappct.Site()
        for s in strings:
            try:
                site.grouping_regex.search(s).group(3)
            except AttributeError:
                self.fail(
                    "Unable to parse massctapp string: '{s}'".format(s=s))
Ejemplo n.º 3
0
 def validate_mass_string_parse(self, strings, site_id):
     """Non-test method"""
     if site_id not in ['mass', 'massappct']:
         self.fail("You provided an invalid site string to validate_mass_string_parse: %s" % site_id)
     site = mass.Site() if site_id == 'mass' else massappct.Site()
     for raw_string, parsed in strings.items():
         try:
             # make sure name is parsed
             self.assertEqual(
                 site.grouping_regex.search(raw_string).group(1).strip(),
                 parsed[0],
             )
             # make sure docket is parsed
             self.assertEqual(
                 site.grouping_regex.search(raw_string).group(2).strip(),
                 parsed[1],
             )
         except AttributeError:
             self.fail("Unable to parse %s string: '%s'" % (site_id, raw_string))