Skip to content

Commit

Permalink
Merge pull request #172 from patymori/tk-170
Browse files Browse the repository at this point in the history
Corrige url_segment de fascículo p/ volume alfanumérico e nulo
  • Loading branch information
patymori authored Jul 10, 2019
2 parents 7e480a4 + 6eee376 commit 6558e45
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ matrix:
include:
- python: 2.7
env: TOX_ENV=py27
- python: 3.3
env: TOX_ENV=py33
- python: 3.4
env: TOX_ENV=py34
- python: 3.5
Expand Down
2 changes: 1 addition & 1 deletion legendarium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = 'Jamil Atta Junior'
__email__ = 'jamil.atta@scielo.org'
__version__ = '0.1.0'
__version__ = '2.0.4'
7 changes: 5 additions & 2 deletions legendarium/urlegendarium.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ def _clean_year_pub(self):

def _clean_volume(self):
"""
Clean the volume removing all caracter and keep just numbers.
Clean the volume stripped the beginning and the end of the string.
"""
return self._get_numbers(self.volume)
if self.volume:
return self.volume.strip()
else:
return ''

def _clean_number(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name='legendarium',
version='2.0.2',
version='2.0.4',
description="Python library to handle SciELO's bibliographic legend",
long_description=readme + '\n\n' + history,
author="Jamil Atta Junior",
Expand Down
3 changes: 3 additions & 0 deletions tests/test_legendarium.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def setUp(self):

self.legendarium = CitationFormatter(**self.sample)

@unittest.skip("Retirar setlocale do teste")
def test_descriptive_ymd_date_pt(self):

import locale
Expand All @@ -47,6 +48,7 @@ def test_descriptive_ymd_date_pt(self):
legendarium.descriptive_dmy_date
)

@unittest.skip("Retirar setlocale do teste")
def test_descriptive_ymd_date_en(self):

import locale
Expand All @@ -62,6 +64,7 @@ def test_descriptive_ymd_date_en(self):
legendarium.descriptive_dmy_date
)

@unittest.skip("Retirar setlocale do teste")
def test_descriptive_ymd_date_es(self):

import locale
Expand Down
16 changes: 16 additions & 0 deletions tests/test_urlegendarium.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ def test_build_url_issue_supplment_number(self):

self.assertEqual(u'spm/2011.v67n9suppl3', leg.url_issue)

def test_build_url_issue_no_volume(self):

del(self.dict_leg['volume']) # Remove the volume

leg = URLegendarium(**self.dict_leg)

self.assertEqual(u'spm/2011.n9suppl3', leg.url_issue)

def test_build_url_issue_alphanum_volume(self):

self.dict_leg['volume'] = u'alphavol'

leg = URLegendarium(**self.dict_leg)

self.assertEqual(u'spm/2011.valphavoln9suppl3', leg.url_issue)

def test_build_url_article_with_doi_param(self):
del(self.dict_leg['suppl_number']) # Remove the suppl_number
del(self.dict_leg['article_id'])
Expand Down

0 comments on commit 6558e45

Please sign in to comment.