Skip to content

Commit 187e6ac

Browse files
committed
improve tests
1 parent 825ceb3 commit 187e6ac

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
language: python
2-
sudo: false
32

43
python:
54
- "2.7"

tests/runtests.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pydf import generate_pdf, get_version, get_help, get_extended_help
55

66

7-
class PywkherTestCase(TestCase):
7+
class PydfTestCase(TestCase):
88
def test_generate_pdf_with_html(self):
99
pdf_content = generate_pdf('<html><body>Is this thing on?</body></html>')
1010
assert pdf_content[:4] == '%PDF'
@@ -53,29 +53,14 @@ def test_extra_kwargs(self):
5353

5454
def test_wrong_path(self):
5555
os.environ['WKHTMLTOPDF_CMD'] = 'foo bar'
56-
try:
57-
get_help()
58-
except IOError:
59-
pass
60-
else:
61-
raise AssertionError('should have raised IOError with wrong WKHTMLTOPDF_CMD')
56+
self.assertRaises(IOError, get_help)
6257
del os.environ['WKHTMLTOPDF_CMD']
6358

6459
def test_no_arguments(self):
65-
try:
66-
generate_pdf()
67-
except TypeError:
68-
pass
69-
else:
70-
raise AssertionError('Should have raised a TypeError')
60+
self.assertRaises(TypeError, generate_pdf)
7161

72-
def test_no_arguments(self):
73-
try:
74-
generate_pdf('www.')
75-
except IOError:
76-
pass
77-
else:
78-
raise AssertionError('Should have raised a IOError')
62+
def test_bad_arguments(self):
63+
self.assertRaises(IOError, generate_pdf, 'www.')
7964

8065
def test_get_version(self):
8166
print get_version()

0 commit comments

Comments
 (0)