7
7
from InvoiceGenerator .api import Client , Creator , Invoice , Item , Provider
8
8
from InvoiceGenerator .pdf import CorrectingInvoice , ProformaInvoice , SimpleInvoice
9
9
10
- from PyPDF2 import PdfFileReader
10
+ from PyPDF2 import PdfReader
11
11
12
12
13
13
class TestBaseInvoice (unittest .TestCase ):
@@ -77,10 +77,10 @@ def test_generate(self):
77
77
pdf = CorrectingInvoice (invoice )
78
78
pdf .gen (tmp_file1 .name )
79
79
80
- pdf = PdfFileReader (tmp_file1 )
81
- pdf_string = pdf .pages [1 ].extractText ()
82
- self .assertTrue (u"Celkem s DPH: 32 255,- K… " in pdf_string )
83
- self .assertTrue (u"Vytvo⁄il : blah" in pdf_string )
80
+ pdf = PdfReader (tmp_file1 )
81
+ pdf_string = pdf .pages [1 ].extract_text ()
82
+ self .assertTrue (u"Celkem s DPH: 32 255,- Kč " in pdf_string )
83
+ self .assertTrue (u"Vytvořil : blah" in pdf_string )
84
84
85
85
def test_generate_proforma (self ):
86
86
provider = Provider ('Pupik' )
@@ -136,9 +136,9 @@ def test_generate_proforma(self):
136
136
pdf = ProformaInvoice (invoice )
137
137
pdf .gen (tmp_file .name , True )
138
138
139
- pdf = PdfFileReader (tmp_file )
140
- pdf_string = pdf .pages [1 ].extractText ()
141
- self .assertTrue (u"Celkem s DPH: 32 255,- K… " in pdf_string )
139
+ pdf = PdfReader (tmp_file )
140
+ pdf_string = pdf .pages [1 ].extract_text ()
141
+ self .assertTrue (u"Celkem s DPH: 32 255,- Kč " in pdf_string )
142
142
143
143
def test_generate_with_vat (self ):
144
144
os .environ ["INVOICE_LANG" ] = "en"
@@ -157,8 +157,8 @@ def test_generate_with_vat(self):
157
157
pdf = SimpleInvoice (invoice )
158
158
pdf .gen (tmp_file .name )
159
159
160
- pdf = PdfFileReader (tmp_file )
161
- pdf_string = pdf .pages [0 ].extractText ()
160
+ pdf = PdfReader (tmp_file )
161
+ pdf_string = pdf .pages [0 ].extract_text ()
162
162
self .assertTrue (u"$3,000.00" in pdf_string )
163
163
self .assertTrue (u"Total with tax: $30,150.00" in pdf_string )
164
164
self .assertTrue (u"Creator: blah" in pdf_string )
0 commit comments