Ejemplo n.º 1
0
def test_byline_to_names_semicolon_seperated_names_and_for():
    names = byline_to_names(
        'Sara Malm;Annette Witheridge;Ian Drury for the Daily Mail;'
        'Daniel Bates')
    assert len(names) == 4
    assert names[2][0] == 'Ian'
    assert names[2][1] == 'Drury'
Ejemplo n.º 2
0
 def test_in_in_byline(self):
     byline = (' By Erika Solomon in Beirut and Borzou Daragahi,'
               ' Middle East correspondent')
     names = byline_to_names(byline)
     self.assertEqual(len(names), 2)
     self.assertEqual(names[0][0], 'Erika')
     self.assertEqual(names[1][0], 'Borzou')
Ejemplo n.º 3
0
 def test_semicolon_seperated_names_and_for(self):
     names = byline_to_names(
         'Sara Malm;Annette Witheridge;Ian Drury for the Daily Mail;'
         'Daniel Bates')
     self.assertEqual(len(names), 4)
     self.assertEqual(names[2][0], 'Ian')
     self.assertEqual(names[2][1], 'Drury')
Ejemplo n.º 4
0
def test_byline_to_names_in_in_byline():
    byline = (
        ' By Erika Solomon in Beirut and Borzou Daragahi,'
        ' Middle East correspondent'
    )
    names = byline_to_names(byline)
    assert len(names) == 2
    assert names[0][0] == 'Erika'
    assert names[1][0] == 'Borzou'
Ejemplo n.º 5
0
 def test_semicolon_seperated_names_and_for(self):
     byline = (
         'Sara Malm;Annette Witheridge;Ian Drury for the Daily Mail;'
         'Daniel Bates'
     )
     names = byline_to_names(byline)
     self.assertEqual(len(names), 4)
     self.assertEqual(names[2][0], 'Ian')
     self.assertEqual(names[2][1], 'Drury')
Ejemplo n.º 6
0
 def test_in_in_byline(self):
     byline = (
         ' By Erika Solomon in Beirut and Borzou Daragahi,'
         ' Middle East correspondent'
     )
     names = byline_to_names(byline)
     self.assertEqual(len(names), 2)
     self.assertEqual(names[0][0], 'Erika')
     self.assertEqual(names[1][0], 'Borzou')
Ejemplo n.º 7
0
def test_byline_to_names_byline_ends_with_comma():
    names = byline_to_names('by \n Tony Smith, \n')
    assert len(names) == 1
    assert names[0][0] == 'Tony'
Ejemplo n.º 8
0
def test_byline_to_names_two_author_seperated_by_comma():
    names = byline_to_names('\n By Roger Highfield, Science Editor \n')
    assert len(names) == 1
    assert names[0][0] == 'Roger'
Ejemplo n.º 9
0
 def test_the_triggers_nofirst_fulllast(self):
     # https://www.nytimes.com/2016/01/08/opinion/a-shameful-round-up-of-refugees.html?_r=0
     first, last = byline_to_names('THE EDITORIAL BOARD')[0]
     self.assertEqual(first, '')
     self.assertEqual(last, 'The Editorial Board')
Ejemplo n.º 10
0
 def test_newline_after_and(self):
     names = byline_to_names('\nIan Sample and \nStuart Clark in Darmstadt')
     self.assertEqual(len(names), 2)
     self.assertEqual(names[1][1], 'Clark')
Ejemplo n.º 11
0
 def test_the_triggers_nofirst_fulllast(self):
     # https://www.nytimes.com/2016/01/08/opinion/a-shameful-round-up-of-refugees.html?_r=0
     first, last = byline_to_names('THE EDITORIAL BOARD')[0]
     self.assertEqual(first, '')
     self.assertEqual(last, 'The Editorial Board')
Ejemplo n.º 12
0
 def test_byline_ends_with_comma(self):
     names = byline_to_names('by \n Tony Smith, \n')
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0][0], 'Tony')
Ejemplo n.º 13
0
 def test_two_author_seperated_by_comma(self):
     names = byline_to_names('\n By Roger Highfield, Science Editor \n')
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0][0], 'Roger')
Ejemplo n.º 14
0
 def test_byline_ends_with_comma(self):
     byline = 'by \n Tony Smith, \n'
     names = byline_to_names(byline)
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0][0], 'Tony')
Ejemplo n.º 15
0
 def test_two_author_seperated_by_comma(self):
     byline = '\n By Roger Highfield, Science Editor \n'
     names = byline_to_names(byline)
     self.assertEqual(len(names), 1)
     self.assertEqual(names[0][0], 'Roger')
Ejemplo n.º 16
0
def test_byline_to_names_newline_after_and():
    names = byline_to_names('\nIan Sample and \nStuart Clark in Darmstadt')
    assert len(names) == 2
    assert names[1][1] == 'Clark'
Ejemplo n.º 17
0
def test_byline_to_names_the_triggers_nofirst_fulllast():
    # https://www.nytimes.com/2016/01/08/opinion/a-shameful-round-up-of-refugees.html?_r=0
    first, last = byline_to_names('THE EDITORIAL BOARD')[0]
    assert first == ''
    assert last == 'The Editorial Board'
Ejemplo n.º 18
0
 def test_newline_after_and(self):
     byline = '\nIan Sample and \nStuart Clark in Darmstadt'
     names = byline_to_names(byline)
     self.assertEqual(len(names), 2)
     self.assertEqual(names[1][1], 'Clark')