def _get_case_names(self): path = "//item/title/text()" case_names = [] for s in self.html.xpath(path): case_name = re.search(self.regex, s).group(2) case_names.append(fix_camel_case(case_name)) return case_names
def _get_case_names(self): path = '//item/title/text()' case_names = [] for s in self.html.xpath(path): case_name = re.search(self.regex, s).group(2) case_names.append(fix_camel_case(case_name)) return case_names
def test_fixing_camel_case(self): """Can we correctly identify and fix camelCase?""" test_pairs = ( # A nasty one with a v in the middle and two uppercase letters ('Metropolitanv.PAPublic', 'Metropolitan v. PA Public'), # An OK string. ('In Re Avandia Marketing Sales Practices & Products Liability Litigation', 'In Re Avandia Marketing Sales Practices & Products Liability Litigation' ), # Partial camelCase should be untouched. ('PPL EnergyPlus, LLC, et al v. Solomon, et al', 'PPL EnergyPlus, LLC, et al v. Solomon, et al'), # The v. has issues. ('Pagliaccettiv.Kerestes', 'Pagliaccetti v. Kerestes'), ('Coxv.Hornetal', 'Cox v. Horn'), ('InReNortelNetworksInc', 'In Re Nortel Networks Inc'), # Testing with a Mc. ('McLaughlinv.Hallinan', 'McLaughlin v. Hallinan'), # Ends with uppercase letter ('TourchinvAttyGenUSA', 'Tourchin v. Atty Gen USA'), ('USAv.Brown', 'USA v. Brown'), # Fix 'of', ',etal', and the problems ('RawdinvTheAmericanBrdofPediatrics', 'Rawdin v. The American Brd of Pediatrics'), ('Santomenno,etalv.JohnHancockLifeInsuranceCompany,etal', 'Santomenno v. John Hancock Life Insurance Company'), ('BaughvSecretaryoftheNavy', 'Baugh v. Secretary of the Navy'), ('Smallv.CamdenCountyetal', 'Small v. Camden County'), ) for pair in test_pairs: self.assertEqual(pair[1], fix_camel_case(pair[0]))
def _get_case_names(self): path = '//item/title/text()' case_names = [] for s in self.html.xpath(path): case_name = re.search('(\d{2}-\d{3,4})?(.+).wma', s).group(2) case_names.append(fix_camel_case(case_name)) return case_names
def test_fixing_camel_case(self): """Can we correctly identify and fix camelCase?""" test_pairs = ( # A nasty one with a v in the middle and two uppercase letters ("Metropolitanv.PAPublic", "Metropolitan v. PA Public"), # An OK string. ( "In Re Avandia Marketing Sales Practices & Products Liability " "Litigation", "In Re Avandia Marketing Sales Practices & Products Liability " "Litigation", ), # Partial camelCase should be untouched. ("PPL EnergyPlus, LLC, et al v. Solomon, et al", "PPL EnergyPlus, LLC, et al v. Solomon, et al"), # The v. has issues. ("Pagliaccettiv.Kerestes", "Pagliaccetti v. Kerestes"), ("Coxv.Hornetal", "Cox v. Horn"), ("InReNortelNetworksInc", "In Re Nortel Networks Inc"), # Testing with a Mc. ("McLaughlinv.Hallinan", "McLaughlin v. Hallinan"), # Ends with uppercase letter ("TourchinvAttyGenUSA", "Tourchin v. Atty Gen USA"), ("USAv.Brown", "USA v. Brown"), # Fix 'of', ',etal', 'the', and 'Inre' problems ("RawdinvTheAmericanBrdofPediatrics", "Rawdin v. The American Brd of Pediatrics"), ( "Santomenno,etalv.JohnHancockLifeInsuranceCompany,etal", "Santomenno v. John Hancock Life Insurance Company", ), ("BaughvSecretaryoftheNavy", "Baugh v. Secretary of the Navy"), ("Smallv.CamdenCountyetal", "Small v. Camden County"), ("InreSCHCorpv.CFIClass", "In Re SCH Corp v. CFI Class"), ) for pair in test_pairs: self.assertEqual(pair[1], fix_camel_case(pair[0]))
def test_fixing_camel_case(self): """Can we correctly identify and fix camelCase?""" test_pairs = ( # A nasty one with a v in the middle and two uppercase letters ('Metropolitanv.PAPublic', 'Metropolitan v. PA Public'), # An OK string. ( 'In Re Avandia Marketing Sales Practices & Products Liability ' 'Litigation', 'In Re Avandia Marketing Sales Practices & Products Liability ' 'Litigation'), # Partial camelCase should be untouched. ('PPL EnergyPlus, LLC, et al v. Solomon, et al', 'PPL EnergyPlus, LLC, et al v. Solomon, et al'), # The v. has issues. ('Pagliaccettiv.Kerestes', 'Pagliaccetti v. Kerestes'), ('Coxv.Hornetal', 'Cox v. Horn'), ('InReNortelNetworksInc', 'In Re Nortel Networks Inc'), # Testing with a Mc. ('McLaughlinv.Hallinan', 'McLaughlin v. Hallinan'), # Ends with uppercase letter ('TourchinvAttyGenUSA', 'Tourchin v. Atty Gen USA'), ('USAv.Brown', 'USA v. Brown'), # Fix 'of', ',etal', and the problems ('RawdinvTheAmericanBrdofPediatrics', 'Rawdin v. The American Brd of Pediatrics'), ('Santomenno,etalv.JohnHancockLifeInsuranceCompany,etal', 'Santomenno v. John Hancock Life Insurance Company'), ('BaughvSecretaryoftheNavy', 'Baugh v. Secretary of the Navy'), ('Smallv.CamdenCountyetal', 'Small v. Camden County'), ) for pair in test_pairs: self.assertEqual(pair[1], fix_camel_case(pair[0]))
def test_fixing_camel_case(self): """Can we correctly identify and fix camelCase?""" test_pairs = ( # A nasty one with a v in the middle and two uppercase letters ("Metropolitanv.PAPublic", "Metropolitan v. PA Public"), # An OK string. ( "In Re Avandia Marketing Sales Practices & Products Liability " "Litigation", "In Re Avandia Marketing Sales Practices & Products Liability " "Litigation", ), # Partial camelCase should be untouched. ( "PPL EnergyPlus, LLC, et al v. Solomon, et al", "PPL EnergyPlus, LLC, et al v. Solomon, et al", ), # The v. has issues. ("Pagliaccettiv.Kerestes", "Pagliaccetti v. Kerestes"), ("Coxv.Hornetal", "Cox v. Horn"), ("InReNortelNetworksInc", "In Re Nortel Networks Inc"), # Testing with a Mc. ("McLaughlinv.Hallinan", "McLaughlin v. Hallinan"), # Ends with uppercase letter ("TourchinvAttyGenUSA", "Tourchin v. Atty Gen USA"), ("USAv.Brown", "USA v. Brown"), # Fix 'of', ',etal', 'the', and 'Inre' problems ( "RawdinvTheAmericanBrdofPediatrics", "Rawdin v. The American Brd of Pediatrics", ), ( "Santomenno,etalv.JohnHancockLifeInsuranceCompany,etal", "Santomenno v. John Hancock Life Insurance Company", ), ("BaughvSecretaryoftheNavy", "Baugh v. Secretary of the Navy"), ("Smallv.CamdenCountyetal", "Small v. Camden County"), ("InreSCHCorpv.CFIClass", "In Re SCH Corp v. CFI Class"), ) for pair in test_pairs: self.assertEqual(pair[1], fix_camel_case(pair[0]))
def _return_case_name(e): case_name = re.search('(\d{2}.*\d{3,4})?(.+).wma', e).group(2) return fix_camel_case(case_name)