@@ -1044,7 +1044,9 @@ def test_lowercase_middle_initial_comma_lastname_and_suffix_conflict_with_conjun
1044
1044
self .m (hn .last , "Smith" , hn )
1045
1045
self .m (hn .suffix , "III, Jr" , hn )
1046
1046
1047
+ @unittest .expectedFailure
1047
1048
def test_two_initials_conflict_with_conjunction (self ):
1049
+ # Supporting this seems to screw up titles with periods in them like M.B.A.
1048
1050
hn = HumanName ('E.T. Smith' )
1049
1051
self .m (hn .first , "E." , hn )
1050
1052
self .m (hn .middle , "T." , hn )
@@ -1270,7 +1272,85 @@ def test_parenthesis_are_removed2(self):
1270
1272
self .m (hn .suffix , "Jr." , hn )
1271
1273
1272
1274
1275
+ class SuffixesTestCase (HumanNameTestBase ):
1276
+
1277
+ def test_suffix (self ):
1278
+ hn = HumanName ("Joe Franklin Jr" )
1279
+ self .m (hn .first , "Joe" , hn )
1280
+ self .m (hn .last , "Franklin" , hn )
1281
+ self .m (hn .suffix , "Jr" , hn )
1282
+
1283
+ def test_suffix_with_periods (self ):
1284
+ hn = HumanName ("Joe Dentist D.D.S." )
1285
+ self .m (hn .first , "Joe" , hn )
1286
+ self .m (hn .last , "Dentist" , hn )
1287
+ self .m (hn .suffix , "D.D.S." , hn )
1288
+
1289
+ def test_two_suffixes (self ):
1290
+ hn = HumanName ("Kenneth Clarke QC MP" )
1291
+ self .m (hn .first , "Kenneth" , hn )
1292
+ self .m (hn .last , "Clarke" , hn )
1293
+ # NOTE: this adds a comma when the orginal format did not have one.
1294
+ # not ideal but at least its in the right bucket
1295
+ self .m (hn .suffix , "QC, MP" , hn )
1296
+
1297
+ def test_two_suffixes_lastname_comma_format (self ):
1298
+ hn = HumanName ("Washington Jr. MD, Franklin" )
1299
+ self .m (hn .first , "Franklin" , hn )
1300
+ self .m (hn .last , "Washington" , hn )
1301
+ # NOTE: this adds a comma when the orginal format did not have one.
1302
+ self .m (hn .suffix , "Jr., MD" , hn )
1303
+
1304
+ def test_two_suffixes_suffix_comma_format (self ):
1305
+ hn = HumanName ("Franklin Washington, Jr. MD" )
1306
+ self .m (hn .first , "Franklin" , hn )
1307
+ self .m (hn .last , "Washington" , hn )
1308
+ self .m (hn .suffix , "Jr. MD" , hn )
1309
+
1310
+ def test_suffix_containing_periods (self ):
1311
+ hn = HumanName ("Kenneth Clarke Q.C." )
1312
+ self .m (hn .first , "Kenneth" , hn )
1313
+ self .m (hn .last , "Clarke" , hn )
1314
+ self .m (hn .suffix , "Q.C." , hn )
1315
+
1316
+ def test_suffix_containing_periods_lastname_comma_format (self ):
1317
+ hn = HumanName ("Clarke, Kenneth, Q.C. M.P." )
1318
+ self .m (hn .first , "Kenneth" , hn )
1319
+ self .m (hn .last , "Clarke" , hn )
1320
+ self .m (hn .suffix , "Q.C. M.P." , hn )
1321
+
1322
+ def test_suffix_containing_periods_suffix_comma_format (self ):
1323
+ hn = HumanName ("Kenneth Clarke Q.C., M.P." )
1324
+ self .m (hn .first , "Kenneth" , hn )
1325
+ self .m (hn .last , "Clarke" , hn )
1326
+ self .m (hn .suffix , "Q.C., M.P." , hn )
1327
+
1328
+ def test_suffix_with_single_comma_format (self ):
1329
+ hn = HumanName ("John Doe jr., MD" )
1330
+ self .m (hn .first , "John" , hn )
1331
+ self .m (hn .last , "Doe" , hn )
1332
+ self .m (hn .suffix , "jr., MD" , hn )
1333
+
1334
+ def test_suffix_with_double_comma_format (self ):
1335
+ hn = HumanName ("Doe, John jr., MD" )
1336
+ self .m (hn .first , "John" , hn )
1337
+ self .m (hn .last , "Doe" , hn )
1338
+ self .m (hn .suffix , "jr., MD" , hn )
1339
+
1340
+ #http://en.wikipedia.org/wiki/Ma_(surname)
1341
+ def test_potential_suffix_that_is_also_last_name (self ):
1342
+ hn = HumanName ("Jack Ma" )
1343
+ self .m (hn .first , "Jack" , hn )
1344
+ self .m (hn .last , "Ma" , hn )
1345
+
1346
+ def test_potential_suffix_that_is_also_last_name_with_suffix (self ):
1347
+ hn = HumanName ("Jack Ma Jr" )
1348
+ self .m (hn .first , "Jack" , hn )
1349
+ self .m (hn .last , "Ma" , hn )
1350
+ self .m (hn .suffix , "Jr" , hn )
1351
+
1273
1352
class HumanNameTitleTestCase (HumanNameTestBase ):
1353
+
1274
1354
def test_last_name_is_also_title (self ):
1275
1355
hn = HumanName ("Amy E Maid" )
1276
1356
self .m (hn .first , "Amy" , hn )
@@ -1306,18 +1386,6 @@ def test_title_is_title(self):
1306
1386
hn = HumanName ("Coach" )
1307
1387
self .m (hn .title , "Coach" , hn )
1308
1388
1309
- def test_suffix_with_single_comma_format (self ):
1310
- hn = HumanName ("John Doe jr., MD" )
1311
- self .m (hn .first , "John" , hn )
1312
- self .m (hn .last , "Doe" , hn )
1313
- self .m (hn .suffix , "jr., MD" , hn )
1314
-
1315
- def test_suffix_with_double_comma_format (self ):
1316
- hn = HumanName ("Doe, John jr., MD" )
1317
- self .m (hn .first , "John" , hn )
1318
- self .m (hn .last , "Doe" , hn )
1319
- self .m (hn .suffix , "jr., MD" , hn )
1320
-
1321
1389
# TODO: fix handling of U.S.
1322
1390
@unittest .expectedFailure
1323
1391
def test_chained_title_first_name_initial (self ):
@@ -1354,17 +1422,17 @@ def test_chained_hyphenated_title_with_comma_suffix(self):
1354
1422
self .m (hn .middle , "G" , hn )
1355
1423
self .m (hn .last , "Davis" , hn )
1356
1424
self .m (hn .suffix , "III" , hn )
1357
-
1425
+
1358
1426
@unittest .expectedFailure
1359
1427
def test_title_multiple_titles_with_conjunctions (self ):
1360
- # I think it finds the index of the wrong 'the'. I get confused because it
1428
+ # FIXME: I think it finds the index of the wrong 'the'. I get confused because it
1361
1429
# loops in reverse order.
1362
1430
hn = HumanName ("The Right Hon. the President of the Queen's Bench Division" )
1363
1431
self .m (hn .title , "The Right Hon. the President of the Queen's Bench Division" , hn )
1364
1432
1365
1433
@unittest .expectedFailure
1366
1434
def test_conjunction_before_title (self ):
1367
- # TODO : seems fixable
1435
+ # FIXME : seems fixable
1368
1436
hn = HumanName ('The Lord of the Universe' )
1369
1437
self .m (hn .title , "The Lord of the Universe" , hn )
1370
1438
@@ -1388,7 +1456,9 @@ def test_title_with_last_initial_is_suffix(self):
1388
1456
self .m (hn .first , "John" , hn )
1389
1457
self .m (hn .last , "V." , hn )
1390
1458
1391
- def test_lc_comparison_of_title (self ):
1459
+ @unittest .expectedFailure
1460
+ def test_two_title_parts_separated_by_commas (self ):
1461
+ # supporting this currently messes up supporting suffixes like M.B.A.
1392
1462
hn = HumanName ("Lt.Gen. John A. Kenneth Doe IV" )
1393
1463
self .m (hn .title , "Lt. Gen." , hn )
1394
1464
self .m (hn .first , "John" , hn )
@@ -1438,10 +1508,11 @@ def test_possible_conflict_with_suffix_that_could_be_initial(self):
1438
1508
1439
1509
# 'ben' is removed from PREFIXES in v0.2.5
1440
1510
# this test could re-enable this test if we decide to support 'ben' as a prefix
1441
- # def test_ben_as_conjunction(self):
1442
- # hn = HumanName("Ahmad ben Husain")
1443
- # self.m(hn.first,"Ahmad", hn)
1444
- # self.m(hn.last,"ben Husain", hn)
1511
+ @unittest .expectedFailure
1512
+ def test_ben_as_conjunction (self ):
1513
+ hn = HumanName ("Ahmad ben Husain" )
1514
+ self .m (hn .first ,"Ahmad" , hn )
1515
+ self .m (hn .last ,"ben Husain" , hn )
1445
1516
1446
1517
def test_ben_as_first_name (self ):
1447
1518
hn = HumanName ("Ben Johnson" )
0 commit comments