def test_considers_double_initial_a_first_name(self): self.assertEqual('C.W. Bill Young', self.cleave_to_str('C.W. Bill Young')) self.assertEqual('C.A. "Dutch" Ruppersberger', self.cleave_to_str('C.A. "Dutch" Ruppersberger')) dutch = IndividualNameCleaver('C.A. "Dutch" Ruppersberger').parse() self.assertEqual('"Dutch"', dutch.nick) self.assertIsNone(dutch.middle) self.assertEqual('C.A.', dutch.first)
def test_we_dont_need_no_steeenking_nicknames(self): self.assertEqual('Robert M. McDonnell', str(PoliticianNameCleaver('McDonnell, Robert M (Bob)').parse())) self.assertEqual('John J. Duncan, Jr.', str(PoliticianNameCleaver('John J (Jimmy) Duncan Jr (R)').parse())) self.assertEqual('Christopher Bond', str(PoliticianNameCleaver('Christopher "Kit" Bond').parse())) self.assertEqual('"Kit"', IndividualNameCleaver('Christopher "Kit" Bond').parse().nick)
def test_unparseable_individual_name(self): with self.assertRaises(UnparseableNameException): IndividualNameCleaver("mr & mrs").parse()
def test_individual(self): self.assertEqual(u'Tobias F\u00fcnke'.encode('utf-8'), str(IndividualNameCleaver(u'F\u00fcnke, Tobias').parse()))