Repository: scieloorg/xylose

Issue:
[referências] Trocar o nome dos atributos analytic_authors e monographic_authors
- De analytic_authors para analytic_person_authors
- De monographic_authors para monographic_person_authors
Indicar obsolescência

```
    @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

```

Comments:

Patch:
diff --git a/xylose/scielodocument.py b/xylose/scielodocument.py
index da4d426..27af27d 100644
--- a/xylose/scielodocument.py
+++ b/xylose/scielodocument.py
@@ -1,7 +1,6 @@
 # encoding: utf-8
 import sys
 from functools import wraps
-import warnings
 import re
 import unicodedata
 import datetime
@@ -3063,13 +3062,40 @@ class Citation(object):
         ma = self.monographic_authors or []
         return aa + ma
 
+    @property
+    def analytic_person_authors(self):
+        """
+        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
+        and not only articles or books have person authors.
+        IT REPLACES analytic_authors
+        """
+        authors = []
+        for author in self.data.get('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 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
         """
-
+        warn_future_deprecation(
+                'analytic_authors',
+                'analytic_person_authors',
+                'analytic_person_authors is more suitable name'
+        )
         authors = []
         if 'v10' in self.data:
             for author in self.data['v10']:
@@ -3084,13 +3110,41 @@ class Citation(object):
         if len(authors) > 0:
             return authors
 
+    @property
+    def monographic_person_authors(self):
+        """
+        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 REPLACES monographic_authors
+        """
+        authors = []
+        for author in self.data.get('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 monographic_authors(self):
         """
-        This method retrieves the authors of the given book citation. These authors may
+        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.
         """
-
+        warn_future_deprecation(
+                'monographic_authors',
+                'monographic_person_authors',
+                'monographic_person_authors is more suitable name'
+        )
         authors = []
         if 'v16' in self.data:
             for author in self.data['v16']:


Test patch:
diff --git a/tests/test_document.py b/tests/test_document.py
index b2b37dd..46738b9 100644
--- a/tests/test_document.py
+++ b/tests/test_document.py
@@ -4386,6 +4386,112 @@ class CitationTest(unittest.TestCase):
 
         self.assertEqual(citation.authors, [])
 
+    def test_analytic_person_authors(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'}]
+
+        expected = [{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'}]
+
+        citation = Citation(json_citation)
+
+        self.assertEqual(citation.analytic_person_authors, expected)
+
+    def test_without_analytic_person_authors(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_person_authors, None)
+
+    def test_without_analytic_person_authors_but_not_a_book_citation(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'}]
+
+        expected = [{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'}]
+
+        citation = Citation(json_citation)
+
+        self.assertEqual(citation.analytic_person_authors, expected)
+
+    def test_monographic_person_authors(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'}]
+
+        expected = [{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'}]
+
+        citation = Citation(json_citation)
+
+        self.assertEqual(citation.monographic_person_authors, expected)
+
+    def test_without_monographic_person_authors(self):
+        json_citation = {}
+
+        json_citation['v18'] = [{u'_': u'It is the book title'}]
+        json_citation['v16'] = []
+
+        citation = Citation(json_citation)
+
+        self.assertEqual(citation.monographic_person_authors, None)
+
+    def test_without_monographic_person_authors_but_not_a_book_citation(self):
+        json_citation = {}
+
+        json_citation['v30'] = [{u'_': u'It is the journal title'}]
+        json_citation['v12'] = [{u'_': u'It is the article title'}]
+
+        citation = Citation(json_citation)
+
+        self.assertEqual(citation.monographic_person_authors, None)
+
+    def test_pending_deprecation_warning_of_analytic_authors(self):
+        citation = Citation({})
+        with warnings.catch_warnings(record=True) as w:
+            assert citation.analytic_authors is None
+            assert len(w) == 1
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
+
+    def test_pending_deprecation_warning_of_monographic_authors(self):
+        citation = Citation({})
+        with warnings.catch_warnings(record=True) as w:
+            self.assertEqual(citation.monographic_authors, None)
+            assert len(w) == 1
+            assert issubclass(w[-1].category, PendingDeprecationWarning)
+
     def test_monographic_authors(self):
         json_citation = {}