Repository: scieloorg/xylose

Issue:
[referência] Incluir autores institucionais no retorno de authors, analytic_authors, monographic_authors e first_author
authors, analytic_authors, monographic_authors e first_author deveriam retornar autores institucionais, mas não estão.

Mudar de nome e indicar obsolescência para que outras aplicações não quebrem com a mudança.

```
    @property
    def authors(self):

        aa = self.analytic_authors or []
        ma = self.monographic_authors or []
        return aa + ma

```

```
    @property
    def analytic_authors(self):
        """
        This method retrieves the authors of the given citation. These authors
        may correspond to an article, book analytic, link or thesis.
        """

        authors = []
        if 'v10' in self.data:
            for author in self.data['v10']:
                authordict = {}
                if 's' in author:
                    authordict['surname'] = html_decode(author['s'])
                if 'n' in author:
                    authordict['given_names'] = html_decode(author['n'])
                if 's' in author or 'n' in author:
                    authors.append(authordict)

        if len(authors) > 0:
            return authors

```

```
    @property
    def monographic_authors(self):
        """
        This method retrieves the authors of the given book citation. These authors may
        correspond to a book monography citation.
        """

        authors = []
        if 'v16' in self.data:
            for author in self.data['v16']:
                authordict = {}
                if 's' in author:
                    authordict['surname'] = html_decode(author['s'])
                if 'n' in author:
                    authordict['given_names'] = html_decode(author['n'])
                if 's' in author or 'n' in author:
                    authors.append(authordict)

        if len(authors) > 0:
            return authors

```

```
    @property
    def first_author(self):
        """
        This property retrieves the first author of the given citation,
        independent of citation type.

        :returns: dict with keys ``given_names`` and ``surname``
        """

        if self.authors:
            return self.authors[0]
        elif self.monographic_authors:
            return self.monographic_authors[0]
```

Discussion:

Patch:
diff --git a/xylose/scielodocument.py b/xylose/scielodocument.py
index 27af27d..ad6ba0a 100644
--- a/xylose/scielodocument.py
+++ b/xylose/scielodocument.py
@@ -51,8 +51,8 @@ REPLACE_TAGS_MIXED_CITATION = (
 
 
 def warn_future_deprecation(old, new, details=''):
-    warnings.simplefilter("always")
-    msg = '"{}" will be deprected in future version. Use "{}" instead. {}'
+    msg = '"{}" will be deprecated in future version. '.format(old) + \
+        'Use "{}" instead. {}'.format(new, details)
     warnings.warn(msg, PendingDeprecationWarning)
 
 
@@ -2830,9 +2830,8 @@ class Citation(object):
         """
         It retrieves the analytic institution authors of a reference,
         no matter the publication type of the reference.
-        It is not desirable to restrict the conditioned return to the
-        publication type, because some reference standards are very peculiar
-        and not only articles or books have institution authors.
+        It is not desirable to return conditioned to the publication type,
+        because not only articles or books have institution authors.
         IT REPLACES analytic_institution
         """
         institutions = []
@@ -2846,13 +2845,14 @@ class Citation(object):
         """
         This method retrieves the institutions in the given citation. The
         citation must be an article or book citation, if it exists.
-        IT WILL BE DEPRECATED
+        IT WILL BE DEPRECATED. Use analytic_institution_authors instead.
         """
         warn_future_deprecation(
             'analytic_institution',
             'analytic_institution_authors',
-            'analytic_institution_authors is more suitable name and '
-            'returns the authors independending on publication type'
+            'Changes: '
+            '1) analytic_institution_authors is a more suitable name; '
+            '2) reconsidered the constrictions related to the publication type'
         )
         institutions = []
         if self.publication_type in [u'article', u'book']:
@@ -2868,9 +2868,8 @@ class Citation(object):
         """
         It retrieves the monographic institution authors of a reference,
         no matter the publication type of the reference.
-        It is not desirable to restrict the conditioned return to the
-        publication type, because some reference standards are very peculiar
-        and not only books have institution authors.
+        It is not desirable to return conditioned to the publication type,
+        because not only books have institution authors.
         IT REPLACES monographic_institution
         """
         if 'v30' in self.data:
@@ -2886,13 +2885,14 @@ class Citation(object):
         """
         This method retrieves the institutions in the given citation. The
         citation must be a book citation, if it exists.
-        IT WILL BE DEPRECATED
+        IT WILL BE DEPRECATED. Use monographic_institution_authors instead.
         """
         warn_future_deprecation(
             'monographic_institution',
             'monographic_institution_authors',
-            'monographic_institution_authors is more suitable name and '
-            'returns the authors independending on publication type'
+            'Changes: '
+            '1) monographic_institution_authors is a more suitable name; '
+            '2) reconsidered the constrictions related to the publication type'
         )
         institutions = []
         if self.publication_type == u'book' and 'v17' in self.data:
@@ -3056,8 +3056,38 @@ class Citation(object):
             return self.data['v237'][0]['_']
 
     @property
-    def authors(self):
+    def authors_groups(self):
+        """
+        It retrieves all the authors (person and institution) and
+        identifies their type (analytic or monographic).
+        IT REPLACES authors which returns only person authors
+        """
+        authors = {}
+        if self.analytic_authors_group is not None:
+            authors['analytic'] = self.analytic_authors_group
+        if self.monographic_authors_group is not None:
+            authors['monographic'] = self.monographic_authors_group
+        if len(authors) > 0:
+            return authors
 
+    @property
+    def authors(self):
+        """
+        This method retrieves the analytic and monographic person authors
+        of a citation.
+        IT WILL BE DEPRECATED.
+        Use authors_groups to retrieve all the authors (person and institution)
+        and (analytic and monographic)
+        """
+        warn_future_deprecation(
+            'authors',
+            'author_groups',
+            'The atribute "author_groups" returns all the authors '
+            '(person and institution) '
+            'identified by their type (analytic or monographic). '
+            'The atribute "authors" returns only person authors and do not '
+            'differs analytic from monographic'
+        )
         aa = self.analytic_authors or []
         ma = self.monographic_authors or []
         return aa + ma
@@ -3067,8 +3097,8 @@ class Citation(object):
         """
         It retrieves the analytic person authors of a reference,
         no matter the publication type of the reference.
-        It is not desirable to restrict the conditioned return to the
-        publication type, because some reference standards are very peculiar
+        It is not desirable to return conditioned to the
+        publication type, because some reference standards are peculiar
         and not only articles or books have person authors.
         IT REPLACES analytic_authors
         """
@@ -3084,17 +3114,39 @@ class Citation(object):
         if len(authors) > 0:
             return authors
 
+    @property
+    def analytic_authors_group(self):
+        """
+        It retrieves all the analytic authors (person and institution).
+        IT REPLACES analytic_authors which returns only person authors
+        """
+        analytic = {}
+        if self.analytic_person_authors is not None:
+            analytic['person'] = self.analytic_person_authors
+        if self.analytic_institution_authors is not None:
+            analytic['institution'] = self.analytic_institution_authors
+        if len(analytic) > 0:
+            return analytic
+
     @property
     def analytic_authors(self):
         """
-        This method retrieves the authors of the given citation. These authors
-        may correspond to an article, book analytic, link or thesis.
-        IT WILL BE DEPRECATED. Use analytic_person_authors instead
+        It retrieves only analytic person authors of a reference of
+        an article, book chapter, link or thesis.
+        IT WILL BE DEPRECATED.
+        To retrieve only analytic person authors,
+        use analytic_person_authors instead.
+        To retrieve all analytic authors (person and institution),
+        use analytic_authors_group instead.
         """
         warn_future_deprecation(
-                'analytic_authors',
-                'analytic_person_authors',
-                'analytic_person_authors is more suitable name'
+            'analytic_authors',
+            'analytic_person_authors or analytic_authors_group',
+            'The attribute "analytic_authors" returns only person authors. '
+            'To retrieve all the analytic authors (person and institution),'
+            ' use analytic_authors_group. '
+            'To retrieve only the analytic person authors,'
+            ' use analytic_person_authors. '
         )
         authors = []
         if 'v10' in self.data:
@@ -3115,11 +3167,13 @@ class Citation(object):
         """
         It retrieves the monographic person authors of a reference,
         no matter the publication type of the reference.
-        It is not desirable to restrict the conditioned return to the
-        publication type, because some reference standards are very peculiar
-        and not only articles or books have person authors.
+        It is not desirable to return conditioned to the
+        publication type, because some reference standards are peculiar
+        and not only books have person authors.
         IT REPLACES monographic_authors
         """
+        if 'v30' in self.data:
+            return
         authors = []
         for author in self.data.get('v16', []):
             authordict = {}
@@ -3132,18 +3186,38 @@ class Citation(object):
         if len(authors) > 0:
             return authors
 
+    @property
+    def monographic_authors_group(self):
+        """
+        It retrieves all the monographic authors (person and institution).
+        IT REPLACES monographic_authors
+        """
+        monographic = {}
+        if self.monographic_person_authors is not None:
+            monographic['person'] = self.monographic_person_authors
+        if self.monographic_institution_authors is not None:
+            monographic['institution'] = self.monographic_institution_authors
+        if len(monographic) > 0:
+            return monographic
+
     @property
     def monographic_authors(self):
         """
-        This method retrieves the authors of the given book citation.
-        These authors may
-        correspond to a book monography citation.
-        IT WILL BE DEPRECATED. Use monographic_person_authors instead.
+        It retrieves only monographic person authors of a reference.
+        IT WILL BE DEPRECATED.
+        To retrieve only monographic person authors,
+        use monographic_person_authors instead.
+        To retrieve all monographic authors (person and institution),
+        use monographic_authors_group instead.
         """
         warn_future_deprecation(
-                'monographic_authors',
-                'monographic_person_authors',
-                'monographic_person_authors is more suitable name'
+            'monographic_authors',
+            'monographic_person_authors or monographic_authors_group',
+            'The attribute "monographic_authors" returns only person authors. '
+            'To retrieve all the monographic authors (person and institution),'
+            ' use monographic_authors_group. '
+            'To retrieve only the monographic person authors,'
+            ' use monographic_person_authors. '
         )
         authors = []
         if 'v16' in self.data:
@@ -3159,15 +3233,44 @@ class Citation(object):
         if len(authors) > 0:
             return authors
 
+    @property
+    def first_author_info(self):
+        """
+        It retrieves the info of the first author:
+        (analytic or monographic), (person or institution), author data,
+        of a citation, independent of citation type.
+        :returns: (analytic or monographic, person or institution, author data)
+        IT REPLACES first_author
+        """
+        types = [('analytic', 'person'),
+                 ('analytic', 'institution'),
+                 ('monographic', 'person'),
+                 ('monographic', 'institution'),
+                 ]
+        authors = [self.analytic_person_authors,
+                   self.analytic_institution_authors,
+                   self.monographic_person_authors,
+                   self.monographic_institution_authors,
+                   ]
+        for a, a_type in zip(authors, types):
+            if a is not None:
+                return a_type[0], a_type[1], a[0]
+
     @property
     def first_author(self):
         """
-        This property retrieves the first author of the given citation,
+        It retrieves the first person author of the given citation,
         independent of citation type.
-
         :returns: dict with keys ``given_names`` and ``surname``
+        IT WILL BE DEPRECATED. Use first_author_info instead.
         """
-
+        warn_future_deprecation(
+            'first_author',
+            'first_author_info',
+            'The attribute "first_author" returns only a person author. '
+            'The attribute "first_author_info" returns info of the '
+            'first author independing if it is person or institution. '
+        )
         if self.authors:
             return self.authors[0]
         elif self.monographic_authors:


Test patch:
diff --git a/tests/test_document.py b/tests/test_document.py
index 46738b9..9b0e572 100644
--- a/tests/test_document.py
+++ b/tests/test_document.py
@@ -8,6 +8,8 @@ import warnings
 from xylose.scielodocument import Article, Citation, Journal, Issue, html_decode, UnavailableMetadataException
 from xylose import tools
 
+warnings.simplefilter("always")
+
 
 class ToolsTests(unittest.TestCase):
 
@@ -4135,7 +4137,6 @@ class CitationTest(unittest.TestCase):
 
         json_citation['v30'] = [{u'_': u'It is the journal title'}]
         json_citation['v12'] = [{u'_': u'It is the article title'}]
-        json_citation['v11'] = [{u'_': u'Article Institution'}]
         json_citation['v11'] = [
             {u'_': u'Article Institution'},
             {u'_': u'Article Institution 2'},
@@ -4295,6 +4296,16 @@ class CitationTest(unittest.TestCase):
 
         self.assertEqual(citation.institutions, None)
 
+    def test_pending_deprecation_warning_of_authors(self):
+        citation = Citation({})
+        with warnings.catch_warnings(record=True) as w:
+            assert citation.authors == []
+            assert len(w) == 3
+            assert 'authors' in str(w[0].message)
+            assert 'analytic_authors' in str(w[1].message)
+            assert 'monographic_authors' in str(w[2].message)
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
+
     def test_authors_article(self):
         json_citation = {}
 
@@ -4438,6 +4449,232 @@ class CitationTest(unittest.TestCase):
 
         self.assertEqual(citation.analytic_person_authors, expected)
 
+    def test_authors_groups_of_a_chapter(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                ]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        json_citation['v10'] = [
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution 3'},
+            {u'_': u'Article Institution 4'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{'surname': u'Sullivan', u'given_names': u'Mike'},
+                      {'surname': u'Hurricane Carter',
+                      u'given_names': u'Rubin'},
+                      ]
+        expected_m = {'person': expected_p, 'institution': expected_i}
+
+        expected_i = [u'Article Institution 3', u'Article Institution 4']
+        expected_p = [{'surname': u'Maguila Rodrigues',
+                      u'given_names': u'Adilson'},
+                      {u'given_names': u'Acelino Popó Freitas'},
+                      {'surname': u'Zé Marreta'}]
+        expected_a = {'person': expected_p, 'institution': expected_i}
+
+        citation = Citation(json_citation)
+        a = citation.authors_groups
+        self.assertEqual(a['analytic'], expected_a)
+        self.assertEqual(a['monographic'], expected_m)
+        self.assertEqual(
+            citation.authors_groups,
+            {
+                'analytic': expected_a,
+                'monographic': expected_m
+            }
+        )
+
+    def test_authors_groups_of_a_journal(self):
+        json_citation = {}
+        json_citation['v30'] = [{u'_': u'It is the journal title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                ]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        json_citation['v10'] = [
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution 3'},
+            {u'_': u'Article Institution 4'},
+        ]
+        expected_i = [u'Article Institution 3', u'Article Institution 4']
+        expected_p = [{'surname': u'Maguila Rodrigues',
+                      u'given_names': u'Adilson'},
+                      {u'given_names': u'Acelino Popó Freitas'},
+                      {'surname': u'Zé Marreta'}]
+        expected_a = {'person': expected_p, 'institution': expected_i}
+
+        citation = Citation(json_citation)
+        self.assertEqual(
+            citation.authors_groups,
+            {
+                'analytic': expected_a,
+            }
+        )
+
+    def test_without_authors_groups(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        citation = Citation(json_citation)
+        self.assertEqual(citation.authors_groups, None)
+
+    def test_analytic_authors_group_of_a_book(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v10'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{u'given_names': u'Mike', 'surname': u'Sullivan'},
+                    {u'given_names': u'Rubin', u'surname': u'Hurricane Carter'},
+                    {u'given_names': u'Adilson', u'surname': u'Maguila Rodrigues'},
+                    {u'given_names': u'Acelino Popó Freitas'},
+                    {u'surname': u'Zé Marreta'}]
+        expected = {'person': expected_p, 'institution': expected_i}
+        citation = Citation(json_citation)
+        self.assertEqual(citation.analytic_authors_group, expected)
+
+    def test_analytic_authors_group_of_a_chapter(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        json_citation['v10'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{u'given_names': u'Mike', u'surname': u'Sullivan'},
+                    {u'given_names': u'Rubin', u'surname': u'Hurricane Carter'},
+                    {u'given_names': u'Adilson', u'surname': u'Maguila Rodrigues'},
+                    {u'given_names': u'Acelino Popó Freitas'},
+                    {u'surname': u'Zé Marreta'}]
+        expected = {'person': expected_p, 'institution': expected_i}
+        citation = Citation(json_citation)
+        self.assertEqual(citation.analytic_authors_group, expected)
+
+    def test_analytic_authors_group_of_a_journal(self):
+        json_citation = {}
+        json_citation['v30'] = [{u'_': u'It is the journal title'}]
+        json_citation['v12'] = [{u'_': u'It is the article title'}]
+        json_citation['v10'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{u'given_names': u'Mike', u'surname': u'Sullivan'},
+                    {u'given_names': u'Rubin', u'surname': u'Hurricane Carter'},
+                    {u'given_names': u'Adilson', u'surname': u'Maguila Rodrigues'},
+                    {u'given_names': u'Acelino Popó Freitas'},
+                    {u'surname': u'Zé Marreta'}]
+        expected = {'person': expected_p, 'institution': expected_i}
+        citation = Citation(json_citation)
+        self.assertEqual(citation.analytic_authors_group, expected)
+
+    def test_without_analytic_authors_group(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        citation = Citation(json_citation)
+        self.assertEqual(citation.analytic_authors_group, None)
+
+    def test_monographic_authors_group_of_a_book(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v17'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{u'given_names': u'Mike', u'surname': u'Sullivan'},
+                    {u'given_names': u'Rubin', u'surname': u'Hurricane Carter'},
+                    {u'given_names': u'Adilson', u'surname': u'Maguila Rodrigues'},
+                    {u'given_names': u'Acelino Popó Freitas'},
+                    {u'surname': u'Zé Marreta'}]
+        expected = {'person': expected_p, 'institution': expected_i}
+        citation = Citation(json_citation)
+        self.assertEqual(citation.monographic_authors_group, expected)
+
+    def test_monographic_authors_group_of_a_chapter(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v17'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        expected_i = [u'Article Institution', u'Article Institution 2']
+        expected_p = [{u'given_names': u'Mike', u'surname': u'Sullivan'},
+                    {u'given_names': u'Rubin', u'surname': u'Hurricane Carter'},
+                    {u'given_names': u'Adilson', u'surname': u'Maguila Rodrigues'},
+                    {u'given_names': u'Acelino Popó Freitas'},
+                    {u'surname': u'Zé Marreta'}]
+        expected = {'person': expected_p, 'institution': expected_i}
+        citation = Citation(json_citation)
+        self.assertEqual(citation.monographic_authors_group, expected)
+
+    def test_monographic_authors_group_of_a_journal(self):
+        json_citation = {}
+        json_citation['v30'] = [{u'_': u'It is the journal title'}]
+        json_citation['v12'] = [{u'_': u'It is the article title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v17'] = [
+            {u'_': u'Article Institution'},
+            {u'_': u'Article Institution 2'},
+        ]
+        citation = Citation(json_citation)
+        self.assertEqual(citation.monographic_authors_group, None)
+
+    def test_without_monographic_authors_group(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        citation = Citation(json_citation)
+        self.assertEqual(citation.monographic_authors_group, None)
+
     def test_monographic_person_authors(self):
         json_citation = {}
 
@@ -4532,6 +4769,87 @@ class CitationTest(unittest.TestCase):
 
         self.assertEqual(citation.monographic_authors, None)
 
+    def test_pending_deprecation_warning_of_first_author(self):
+        citation = Citation({})
+        with warnings.catch_warnings(record=True) as w:
+            assert citation.first_author is None
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
+            assert len(w) > 1
+            assert 'first_author' in str(w[0].message)
+
+    def test_first_author_info__analytic_person(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                ]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        json_citation['v10'] = [
+                                {u's': u'Maguila Rodrigues', u'n': u'Adilson'},
+                                {u'n': u'Acelino Popó Freitas'},
+                                {u's': u'Zé Marreta'}]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution 3'},
+            {u'_': u'Article Institution 4'},
+        ]
+        citation = Citation(json_citation)
+        self.assertEqual(
+            citation.first_author_info,
+            ('analytic', 'person', {'surname': u'Maguila Rodrigues',
+                                    u'given_names': u'Adilson'})
+        )
+
+    def test_first_author_info__monographic_person(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                ]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        citation = Citation(json_citation)
+        self.assertEqual(
+            citation.first_author_info,
+            ('monographic', 'person',
+                {u'surname': u'Sullivan', u'given_names': u'Mike'},)
+        )
+
+    def test_first_author_info__analytic_institution(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v12'] = [{u'_': u'It is the chapter title'}]
+        json_citation['v16'] = [{u's': u'Sullivan', u'n': u'Mike'},
+                                {u's': u'Hurricane Carter', u'n': u'Rubin'},
+                                ]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        json_citation['v11'] = [
+            {u'_': u'Article Institution 3'},
+            {u'_': u'Article Institution 4'},
+        ]
+        citation = Citation(json_citation)
+        self.assertEqual(
+            citation.first_author_info,
+            ('analytic', 'institution', u'Article Institution 3')
+        )
+
+    def test_first_author_info__monographic_institution(self):
+        json_citation = {}
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v17'] = [{u'_': u'Article Institution'},
+                                {u'_': u'Article Institution 2'},
+                                ]
+        citation = Citation(json_citation)
+        self.assertEqual(
+            citation.first_author_info,
+            ('monographic', 'institution', u'Article Institution')
+        )
+
     def test_first_author_article(self):
         json_citation = {}