forked from josch/img2pdf
Added tests for the package.
parent
b47cc04dd3
commit
db7e74bcfe
@ -0,0 +1,3 @@
|
||||
*.pyc
|
||||
build
|
||||
src/*.egg-info
|
@ -0,0 +1,7 @@
|
||||
import unittest
|
||||
import test_img2pdf
|
||||
|
||||
def test_suite():
|
||||
return unittest.TestSuite((
|
||||
unittest.makeSuite(test_img2pdf.TestImg2Pdf),
|
||||
))
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,20 @@
|
||||
import datetime
|
||||
import os
|
||||
import unittest
|
||||
import img2pdf
|
||||
|
||||
HERE = os.path.dirname(__file__)
|
||||
moddate = datetime.datetime(2014, 1, 1)
|
||||
|
||||
class TestImg2Pdf(unittest.TestCase):
|
||||
def test_jpg2pdf(self):
|
||||
with open(os.path.join(HERE, 'test.jpg'), 'r') as img_fp:
|
||||
with open(os.path.join(HERE, 'test.pdf'), 'r') as pdf_fp:
|
||||
self.assertEqual(
|
||||
img2pdf.convert([img_fp], 150,
|
||||
creationdate=moddate, moddate=moddate),
|
||||
pdf_fp.read())
|
||||
|
||||
def test_png2pdf(self):
|
||||
with open(os.path.join(HERE, 'test.png'), 'r') as img_fp:
|
||||
self.assertRaises(SystemExit, img2pdf.convert, [img_fp], 150)
|
Loading…
Reference in New Issue