예제 #1
0
 def test_extract_multiple_authors_no_oxford_comma(self):
     article = {
         'author_detail': {
             'name': 'BY JOHN HEIMER, HWAIDA SAAD and BEN HUBBARD'
         }
     }
     authors = feed.extract_authors(article)
     author_names = [author.name for author in authors]
     self.assertEqual(author_names, ['John Heimer', 'Hwaida Saad', 'Ben Hubbard'])
     self.assertEqual(Author.query.count(), 3)
예제 #2
0
 def test_extract_multiple_authors_and(self):
     article = {
         'author_detail': {
             'name': 'BY JOHN HEIMER and BEN HUBBARD'
         }
     }
     authors = feed.extract_authors(article)
     author_names = [author.name for author in authors]
     self.assertEqual(author_names, ['John Heimer', 'Ben Hubbard'])
     self.assertEqual(Author.query.count(), 2)
예제 #3
0
 def test_extract_multiple_authors_no_oxford_comma(self):
     article = {
         'author_detail': {
             'name': 'BY JOHN HEIMER, HWAIDA SAAD and BEN HUBBARD'
         }
     }
     authors = feed.extract_authors(article)
     author_names = [author.name for author in authors]
     self.assertEqual(author_names,
                      ['John Heimer', 'Hwaida Saad', 'Ben Hubbard'])
     self.assertEqual(Author.query.count(), 3)
예제 #4
0
 def test_extract_single_authors(self):
     articles = [{
         'author': 'John Heimer'
     }, {
         'author_detail': {
             'name': 'John Heimer'
         }
     }, {
         'author_detail': {
             'name': 'By John Heimer'
         }
     }, {
         'author_detail': {
             'name': 'BY JOHN HEIMER'
         }
     }]
     for article in articles:
         authors = feed.extract_authors(article)
         self.assertEqual(authors[0].name, 'John Heimer')
         self.assertEqual(Author.query.count(), 1)
예제 #5
0
 def test_extract_single_authors(self):
     articles = [{
             'author': 'John Heimer'
         },{
             'author_detail': {
                 'name': 'John Heimer'
             }
         }, {
             'author_detail': {
                 'name': 'By John Heimer'
             }
         }, {
             'author_detail': {
                 'name': 'BY JOHN HEIMER'
             }
         }
     ]
     for article in articles:
         authors = feed.extract_authors(article)
         self.assertEqual(authors[0].name, 'John Heimer')
         self.assertEqual(Author.query.count(), 1)
예제 #6
0
 def test_extract_multiple_authors_and(self):
     article = {'author_detail': {'name': 'BY JOHN HEIMER and BEN HUBBARD'}}
     authors = feed.extract_authors(article)
     author_names = [author.name for author in authors]
     self.assertEqual(author_names, ['John Heimer', 'Ben Hubbard'])
     self.assertEqual(Author.query.count(), 2)