def test_dont_capitalize_just_anything_starting_with_mac(self): self.assertEqual('Machinists/Aerospace Workers Union', str(OrganizationNameCleaver('MACHINISTS/AEROSPACE WORKERS UNION').parse()))
def test_expand(self): self.assertEqual('Raytheon Corporation', OrganizationNameCleaver('Raytheon Corp.').parse().expand()) self.assertEqual('Massachusetts Institute of Technology', OrganizationNameCleaver('Massachusetts Inst. of Technology').parse().expand())
def test_doesnt_bother_names_containing_string_pac(self): self.assertEqual('Pacific Trust', str(OrganizationNameCleaver('PACIFIC TRUST').parse()))
def test_capitalize_scottish_names(self): self.assertEqual('McDonnell Douglas', str(OrganizationNameCleaver('MCDONNELL DOUGLAS').parse())) self.assertEqual('MacDonnell Douglas', str(OrganizationNameCleaver('MACDONNELL DOUGLAS').parse()))
def test_make_single_word_names_ending_in_pac_all_uppercase(self): self.assertEqual('ECEPAC', str(OrganizationNameCleaver('ECEPAC').parse()))
def test_names_starting_with_PAC(self): self.assertEqual('PAC For Engineers', str(OrganizationNameCleaver('PAC FOR ENGINEERS').parse())) self.assertEqual('PAC 102', str(OrganizationNameCleaver('PAC 102').parse()))
def test_handles_empty_names(self): self.assertEqual('', str(OrganizationNameCleaver('').parse()))
def test_capitalize_pac(self): self.assertEqual('Nancy Pelosi Leadership PAC', str(OrganizationNameCleaver('NANCY PELOSI LEADERSHIP PAC').parse()))
def test_expand_with_two_tokens_to_expand(self): self.assertEqual('Merck & Company Incorporated', OrganizationNameCleaver('Merck & Co., Inc.').parse().expand())
def test_drop_postname_hyphen_phrases(self): self.assertEqual('Lawyers For Better Government', OrganizationNameCleaver('LAWYERS FOR BETTER GOVERNMENT-ILLINOIS').parse().without_extra_phrases()) self.assertEqual('Jobs Opportunity And Freedom Political Action Committee', OrganizationNameCleaver('JOBS OPPORTUNITY AND FREEDOM POLITICAL ACTION COMMITTEE - JOFPAC').parse().without_extra_phrases())
def test_parse_safe__organization(self): self.assertEqual('', OrganizationNameCleaver(None).parse(safe=True))
def test_organization(self): self.assertEqual(u'\u00C6tna, Inc.'.encode('utf-8'), str(OrganizationNameCleaver(u'\u00C6tna, Inc.').parse()))
def test_capitalizes_letter_after_hyphen(self): self.assertEqual('Non-Profit Institutions', str(OrganizationNameCleaver('NON-PROFIT INSTITUTIONS').parse())) self.assertEqual('Pro-Israel', str(OrganizationNameCleaver('PRO-ISRAEL').parse()))
def test_capitalizes_letter_after_slash(self): self.assertEqual('Health Services/Hmos', str(OrganizationNameCleaver('HEALTH SERVICES/HMOS').parse())) self.assertEqual('Lawyers/Law Firms', str(OrganizationNameCleaver('LAWYERS/LAW FIRMS').parse()))
def test_overrides_dumb_python_titlecasing_for_apostrophes(self): self.assertEqual('Phoenix Women\'s Health Center', str(OrganizationNameCleaver('PHOENIX WOMEN\'S HEALTH CENTER').parse()))