Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parse_author_affil('Anatoly Zlotnik and Jr-Shin Li'),
[['Zlotnik', 'Anatoly', ''],
['Li', 'Jr-Shin', '']],
'jr issue (Anatoly Zlotnik and Jr-Shin Li)'
)
# ====== Extra tests for arXiv::AuthorAffil ARXIVDEV-728 ======
# [parse_author_affil]
self.assertListEqual(
parse_author_affil(''),
[],
'parse_author_affil (empty)'
)
self.assertListEqual(
parse_author_affil('Simeon Warner Jr'),
[['Warner', 'Simeon', 'Jr']],
'parse_author_affil (basic) 2/12'
)
self.assertListEqual(
parse_author_affil('BELLE Collaboration'),
[['BELLE Collaboration', '', '']],
'parse_author_affil (lone "BELLE Collaboration") 2/3'
)
self.assertListEqual(
parse_author_affil('BELLE Collaboration'),
[['BELLE Collaboration', '', '']],
'parse_author_affil (lone "BELLE Collaboration") 2/3'
)
def test_parse_author_affil_basic2(self):
self.assertListEqual(
parse_author_affil('S.M. Warner'),
[['Warner', 'S. M.', '']])
self.assertListEqual(
parse_author_affil('John Von Neumann'),
[['Von Neumann', 'John', '']])
self.assertListEqual(
parse_author_affil('Herbert Van de Sompel'),
[['Van de Sompel', 'Herbert', '']])
self.assertListEqual(
parse_author_affil('del Norte'),
[['Norte', 'del', '']])
self.assertListEqual(
parse_author_affil('Fred del Norte'),
[['del Norte', 'Fred', '']])
self.assertListEqual(
parse_author_affil('BELLE'),
[['BELLE', '', '']])
self.assertListEqual(
parse_author_affil('BELLE Collaboration: A Person, Nother Person'),
[
['BELLE Collaboration', '', ''],
['Person', 'A', ''],
['Person', 'Nother', '']
def test_parse_author_affil_with_affiliations(self):
self.assertListEqual(
parse_author_affil('sum won (lab a)'),
[['won', 'sum', '', 'lab a']])
self.assertListEqual(
parse_author_affil('sum won (lab a; lab b)'),
[['won', 'sum', '', 'lab a; lab b']])
self.assertListEqual(
parse_author_affil('sum won (lab a, lab b)'),
[['won', 'sum', '', 'lab a, lab b']])
self.assertListEqual(
parse_author_affil('sum won (1,2) ( (1) lab a, (2) lab b)'),
[['won', 'sum', '', 'lab a', 'lab b']])
self.assertListEqual(
parse_author_affil('sum won(1,2)((1)lab a,(2)lab b)'),
[['won', 'sum', '', 'lab a', 'lab b']])
self.assertListEqual(
parse_author_affil('a.b.first, c.d.second (affil)'),
parse_author_affil('Fred del Norte'),
[['del Norte', 'Fred', '']])
self.assertListEqual(
parse_author_affil('BELLE'),
[['BELLE', '', '']])
self.assertListEqual(
parse_author_affil('BELLE Collaboration: A Person, Nother Person'),
[
['BELLE Collaboration', '', ''],
['Person', 'A', ''],
['Person', 'Nother', '']
])
self.assertListEqual(parse_author_affil('The DELPHI Collaboration, J. Abdallah, et al'),
[['The DELPHI Collaboration', '', ''], ['Abdallah', 'J.', '']])
self.assertListEqual(parse_author_affil('Ali Vaziri Astaneh, Federico Fuentes'),
[['Vaziri Astaneh', 'Ali', ''],['Fuentes', 'Federico', '']])
[['Warner', 'Simeon', 'Jr.']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr'),
[['Warner', 'Simeon', 'Sr']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr.'),
[['Warner', 'Simeon', 'Sr.']])
self.assertListEqual(
parse_author_affil('SM Warner'),
[['Warner', 'SM', '']])
self.assertListEqual(
parse_author_affil('SM. Warner'),
[['Warner', 'SM.', '']])
)
# look like bugs, but aren't
self.assertListEqual(
parse_author_affil('sum won ((lab a), (lab b))'),
[['won', 'sum', '']],
'parse_author_affil (bug imposter) 1/2'
)
self.assertListEqual(
parse_author_affil('sum won ((lab a) (lab b))'),
[['won', 'sum', '']],
'parse_author_affil (bug imposter) 2/2'
)
self.assertListEqual(
parse_author_affil('Anatoly Zlotnik and Jr-Shin Li'),
[['Zlotnik', 'Anatoly', ''],
['Li', 'Jr-Shin', '']],
'jr issue (Anatoly Zlotnik and Jr-Shin Li)'
)
# ====== Extra tests for arXiv::AuthorAffil ARXIVDEV-728 ======
# [parse_author_affil]
self.assertListEqual(
parse_author_affil(''),
[],
'parse_author_affil (empty)'
)
self.assertListEqual(
parse_author_affil('Simeon Warner Jr'),
[['Warner', 'Simeon', 'Jr']],
parse_author_affil(
'Matthew Everitt, Robert M. Heath and Viv Kendon'),
[['Everitt', 'Matthew', ''],
['Heath', 'Robert M.', ''],
['Kendon', 'Viv', '']],
'parse_author_affil for 1110.4366'
)
# look like bugs, but aren't
self.assertListEqual(
parse_author_affil('sum won ((lab a), (lab b))'),
[['won', 'sum', '']],
'parse_author_affil (bug imposter) 1/2'
)
self.assertListEqual(
parse_author_affil('sum won ((lab a) (lab b))'),
[['won', 'sum', '']],
'parse_author_affil (bug imposter) 2/2'
)
self.assertListEqual(
parse_author_affil('Anatoly Zlotnik and Jr-Shin Li'),
[['Zlotnik', 'Anatoly', ''],
['Li', 'Jr-Shin', '']],
'jr issue (Anatoly Zlotnik and Jr-Shin Li)'
)
# ====== Extra tests for arXiv::AuthorAffil ARXIVDEV-728 ======
# [parse_author_affil]
self.assertListEqual(
parse_author_affil(''),
[['Warner', 'S. M.', '']])
self.assertListEqual(
parse_author_affil('John Von Neumann'),
[['Von Neumann', 'John', '']])
self.assertListEqual(
parse_author_affil('Herbert Van de Sompel'),
[['Van de Sompel', 'Herbert', '']])
self.assertListEqual(
parse_author_affil('del Norte'),
[['Norte', 'del', '']])
self.assertListEqual(
parse_author_affil('Fred del Norte'),
[['del Norte', 'Fred', '']])
self.assertListEqual(
parse_author_affil('BELLE'),
[['BELLE', '', '']])
self.assertListEqual(
parse_author_affil('BELLE Collaboration: A Person, Nother Person'),
[
['BELLE Collaboration', '', ''],
['Person', 'A', ''],
['Person', 'Nother', '']
])
self.assertListEqual(parse_author_affil('The DELPHI Collaboration, J. Abdallah, et al'),
[['The DELPHI Collaboration', '', ''], ['Abdallah', 'J.', '']])
[['Warner', 'Simeon', 'Jr']])
self.assertListEqual(
parse_author_affil('Simeon Warner Jr.'),
[['Warner', 'Simeon', 'Jr.']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr'),
[['Warner', 'Simeon', 'Sr']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr.'),
[['Warner', 'Simeon', 'Sr.']])
self.assertListEqual(
parse_author_affil('SM Warner'),
[['Warner', 'SM', '']])
self.assertListEqual(
parse_author_affil('SM. Warner'),
[['Warner', 'SM.', '']])
def test_parse_author_affil_basic(self):
self.assertListEqual(parse_author_affil(
'Simeon Warner'), [['Warner', 'Simeon', '']])
self.assertListEqual(
parse_author_affil('Simeon Warner Jr'),
[['Warner', 'Simeon', 'Jr']])
self.assertListEqual(
parse_author_affil('Simeon Warner Jr.'),
[['Warner', 'Simeon', 'Jr.']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr'),
[['Warner', 'Simeon', 'Sr']])
self.assertListEqual(
parse_author_affil('Simeon Warner Sr.'),
[['Warner', 'Simeon', 'Sr.']])
self.assertListEqual(
parse_author_affil('SM Warner'),
[['Warner', 'SM', '']])
self.assertListEqual(
parse_author_affil('SM. Warner'),
[['Warner', 'SM.', '']])