Skip to content

Commit 4683183

Browse files
committed
Add tests for IOError raising
1 parent f368d17 commit 4683183

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/test_io.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import unittest
2+
3+
from test.pattern_for_tests import *
4+
5+
6+
class TestExplicitIOErrors(unittest.TestCase):
7+
def test_read_non_file(self):
8+
"""
9+
1.5.0 adds explicit error raising.
10+
We test that now.
11+
"""
12+
file1 = "nosuchfile.dst"
13+
self.assertRaises(IOError, lambda: EmbPattern(file1))
14+
15+
def test_write_non_supported(self):
16+
"""
17+
1.5.0 adds explicit error raising.
18+
We test that now.
19+
"""
20+
pattern = get_simple_pattern()
21+
file1 = "nosuchfile.pdf"
22+
self.assertRaises(IOError, lambda: pattern.write(file1))
23+
24+
def test_write_no_writer(self):
25+
"""
26+
1.5.0 adds explicit error raising.
27+
We test that now.
28+
"""
29+
pattern = get_simple_pattern()
30+
file1 = "nosuchfile.dat"
31+
self.assertRaises(IOError, lambda: pattern.write(file1))

0 commit comments

Comments
 (0)