Skip to content

Commit

Permalink
Add open(path, pages = [...]) test
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvine committed Jul 30, 2020
1 parent 249754e commit c5e5f4b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_ca_warn_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ class Test(unittest.TestCase):

@classmethod
def setup_class(self):
path = os.path.join(HERE, "pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf")
self.pdf = pdfplumber.open(path)
self.path = os.path.join(HERE, "pdfs/WARN-Report-for-7-1-2015-to-03-25-2016.pdf")
self.pdf = pdfplumber.open(self.path)
self.PDF_WIDTH = self.pdf.pages[0].width

@classmethod
def teardown_class(self):
self.pdf.close()

def test_page_limiting(self):
with pdfplumber.open(self.path, pages = [ 1, 3 ]) as pdf:
assert len(pdf.pages) == 2
assert pdf.pages[1].page_number == 3

def test_objects(self):
assert len(self.pdf.chars)
assert len(self.pdf.rects)
Expand Down

0 comments on commit c5e5f4b

Please sign in to comment.