コード例 #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'
コード例 #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')
コード例 #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')
コード例 #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'
コード例 #5
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')
コード例 #6
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')
コード例 #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'
コード例 #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'
コード例 #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')
コード例 #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')
コード例 #11
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')
コード例 #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')
コード例 #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')
コード例 #14
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')
コード例 #15
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')
コード例 #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'
コード例 #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'
コード例 #18
0
ファイル: urls_authors_test.py プロジェクト: 5j9/yadkard
 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')