Skip to content

Commit

Permalink
Añado examples/BORME-A-2015-27-10.pdf para no tener que descargarlo e…
Browse files Browse the repository at this point in the history
…n tests
  • Loading branch information
PabloCastellano committed Apr 7, 2016
1 parent 5903510 commit 7974062
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bormeparser/backends/pypdf2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ def _parse(self):

if __name__ == '__main__':
import pprint
actos = parse_file('../../../pdf/BORME-A-2015-27-10.pdf')
actos = parse_file('examples/BORME-A-2015-27-10.pdf')
pprint.pprint(actos, width=160)
10 changes: 4 additions & 6 deletions bormeparser/tests/test_borme.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import tempfile
import unittest

import bormeparser
from bormeparser.borme import Borme, BormeActoCargo, BormeActoTexto, BormeAnuncio, BormeXML
from bormeparser.download import download_pdf, download_xml
from bormeparser.exceptions import BormeDoesntExistException
Expand All @@ -35,6 +36,7 @@
# Python 2
FileNotFoundError = IOError

EXAMPLES_PATH = os.path.join(os.path.dirname(bormeparser.__file__), 'examples')

DATA1 = {214: {'Actos': {'Ceses/Dimisiones': {'Adm. Unico': {'JUAN GARCIA GARCIA'}},
'Datos registrales': 'T 5188, L 4095, F 146, S 8, H MA120039, I/A 4 (25.05.15).',
Expand All @@ -52,11 +54,7 @@
class BormeTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.borme = download_pdf((2015, 2, 10), '/tmp/BORME-A-2015-27-10.pdf', SECCION.A, PROVINCIA.CACERES, parse=True)

@classmethod
def tearDownClass(cls):
os.unlink('/tmp/BORME-A-2015-27-10.pdf')
cls.borme = bormeparser.parse(os.path.join(EXAMPLES_PATH, 'BORME-A-2015-27-10.pdf'))

def test_instance(self):
self.assertEqual(self.borme.date, datetime.date(year=2015, month=2, day=10))
Expand All @@ -65,7 +63,7 @@ def test_instance(self):
self.assertEqual(self.borme.num, 27)
self.assertEqual(self.borme.cve, 'BORME-A-2015-27-10')
self.assertEqual(self.borme.url, 'https://boe.es/borme/dias/2015/02/10/pdfs/BORME-A-2015-27-10.pdf')
self.assertEqual(self.borme.filename, '/tmp/BORME-A-2015-27-10.pdf')
self.assertEqual(self.borme.filename, os.path.join(EXAMPLES_PATH, 'BORME-A-2015-27-10.pdf'))

def test_json(self):
fp = tempfile.NamedTemporaryFile()
Expand Down
2 changes: 1 addition & 1 deletion docs/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usar un backend específico
import bormeparser.backends.pypdf2
parser = bormeparser.backends.pypdf2.parser.PyPDF2Parser('pdf/BORME-A-2015-27-10.pdf')
parser = bormeparser.backends.pypdf2.parser.PyPDF2Parser('examples/BORME-A-2015-27-10.pdf')
borme = parser.parse()
Expand Down
Binary file added examples/BORME-A-2015-27-10.pdf
Binary file not shown.

0 comments on commit 7974062

Please sign in to comment.