コード例 #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)
             )
コード例 #2
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))
コード例 #3
0
 def test_mass(self):
     strings = (
         'Massachusetts State Automobile Dealers Association, Inc. v. Tesla Motors MA, Inc. (SJC 11545) (September 15, 2014)',
         'Bower v. Bournay-Bower (SJC 11478) (September 15, 2014)',
         'Commonwealth v. Holmes (SJC 11557) (September 12, 2014)',
         'Superintendent-Director of Assabet Valley Regional School District v. Speicher (SJC 11563) (September 11, 2014)',
         'Commonwealth v. Quinn (SJC 11554) (September 11, 2014)',
         'Commonwealth v. Wall (SJC 09850) (September 11, 2014)',
         'Commonwealth v. Letkowski (SJC 11556) (September 9, 2014)',
         'Commonwealth v. Sullivan (SJC 11568) (September 9, 2014)',
         'Plumb v. Casey (SJC 11519) (September 8, 2014)',
         'A.J. Properties, LLC v. Stanley Black and Decker, Inc. (SJC 11424) (September 5, 2014)',
         'Massachusetts Electric Co. v. Department of Public Utilities (SJC 11526, 11527, 11528) (September 4, 2014)',
     )
     site = mass.Site()
     for s in strings:
         try:
             site.grouping_regex.search(s).group(3)
         except AttributeError:
             self.fail(
                 "Unable to parse mass string: '{s}'".format(s=s))
コード例 #4
0
ファイル: tests.py プロジェクト: uglyboxer/juriscraper
 def test_mass(self):
     strings = {
         'Massachusetts State Automobile Dealers Association, Inc. v. Tesla Motors MA, Inc. (SJC 11545) (September 15, 2014)': [
             'Massachusetts State Automobile Dealers Association, Inc. v. Tesla Motors MA, Inc.',
             'SJC 11545',
             'September 15, 2014',
         ],
         'Bower v. Bournay-Bower (SJC 11478) (September 15, 2014)': [
             'Bower v. Bournay-Bower',
             'SJC 11478',
             'September 15, 2014',
         ],
         'Commonwealth v. Holmes (SJC 11557) (September 12, 2014)': [
             'Commonwealth v. Holmes',
             'SJC 11557',
             'September 12, 2014',
         ],
         'Superintendent-Director of Assabet Valley Regional School District v. Speicher (SJC 11563) (September 11, 2014)': [
             'Superintendent-Director of Assabet Valley Regional School District v. Speicher',
             'SJC 11563',
             'September 11, 2014',
         ],
         'Commonwealth v. Quinn (SJC 11554) (September 11, 2014)': [
             'Commonwealth v. Quinn',
             'SJC 11554',
             'September 11, 2014',
         ],
         'Commonwealth v. Wall (SJC 09850) (September 11, 2014)': [
             'Commonwealth v. Wall',
             'SJC 09850',
             'September 11, 2014',
         ],
         'Commonwealth v. Letkowski (SJC 11556) (September 9, 2014)': [
             'Commonwealth v. Letkowski',
             'SJC 11556',
             'September 9, 2014',
         ],
         'Commonwealth v. Sullivan (SJC 11568) (September 9, 2014)': [
             'Commonwealth v. Sullivan',
             'SJC 11568',
             'September 9, 2014',
         ],
         'Plumb v. Casey (SJC 11519) (September 8, 2014)': [
             'Plumb v. Casey',
             'SJC 11519',
             'September 8, 2014',
         ],
         'A.J. Properties, LLC v. Stanley Black and Decker, Inc. (SJC 11424) (September 5, 2014)': [
             'A.J. Properties, LLC v. Stanley Black and Decker, Inc.',
             'SJC 11424',
             'September 5, 2014',
         ],
         'Massachusetts Electric Co. v. Department of Public Utilities (SJC 11526, 11527, 11528) (September 4, 2014)': [
             'Massachusetts Electric Co. v. Department of Public Utilities',
             'SJC 11526, 11527, 11528',
             'September 4, 2014',
         ],
         'Commonwealth v. Doe (SJC-11861) (October 22, 2015)': [
             'Commonwealth v. Doe',
             'SJC-11861',
             'October 22, 2015',
         ],
     }
     site = mass.Site()
     for k, v in strings.items():
         try:
             self.assertEqual(
                 site.grouping_regex.search(k).group(1).strip(),
                 v[0],
             )
             self.assertEqual(
                 site.grouping_regex.search(k).group(2).strip(),
                 v[1],
             )
             self.assertEqual(
                 site.grouping_regex.search(k).group(3).strip(),
                 v[2],
             )
         except AttributeError:
             self.fail("Unable to parse mass string: '{s}'".format(s=k))