Skip to content

Commit 5f116d5

Browse files
fix incorrect raise tests
1 parent bacdc11 commit 5f116d5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/test_binary_vdf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ def test_dumps_unicode_alternative(self):
6868
def test_dump_params_invalid(self):
6969
with self.assertRaises(TypeError):
7070
vdf.binary_dump([], BytesIO())
71+
with self.assertRaises(TypeError):
7172
vdf.binary_dump({}, b'aaaa')
7273

7374
def test_dumps_params_invalid(self):
7475
with self.assertRaises(TypeError):
7576
vdf.binary_dumps([])
77+
with self.assertRaises(TypeError):
7678
vdf.binary_dumps(b'aaaa')
7779

7880
def test_dumps_key_invalid_type(self):
@@ -94,14 +96,19 @@ def test_alternative_format(self):
9496
def test_load_params_invalid(self):
9597
with self.assertRaises(TypeError):
9698
vdf.binary_load(b'aaaa')
99+
with self.assertRaises(TypeError):
97100
vdf.binary_load(1234)
101+
with self.assertRaises(TypeError):
98102
vdf.binary_load(BytesIO(b'aaaa'), b'bbbb')
99103

100104
def test_loads_params_invalid(self):
101105
with self.assertRaises(TypeError):
102106
vdf.binary_loads([])
107+
with self.assertRaises(TypeError):
103108
vdf.binary_loads(11111)
109+
with self.assertRaises(TypeError):
104110
vdf.binary_loads(BytesIO())
111+
with self.assertRaises(TypeError):
105112
vdf.binary_load(b'', b'bbbb')
106113

107114
def test_loads_unbalanced_nesting(self):

tests/test_vdf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ def tearDown(self):
8585
self.f.close()
8686

8787
def test_dump_params_invalid(self):
88+
# pretty/escaped only accept bool
8889
with self.assertRaises(TypeError):
89-
# pretty/escaped only accept bool
9090
vdf.dump({'a': 1}, StringIO(), pretty=1)
91+
with self.assertRaises(TypeError):
9192
vdf.dumps({'a': 1}, pretty=1)
93+
with self.assertRaises(TypeError):
9294
vdf.dump({'a': 1}, StringIO(), escaped=1)
95+
with self.assertRaises(TypeError):
9396
vdf.dumps({'a': 1}, escaped=1)
9497

9598
def test_routine_dumps_asserts(self):

0 commit comments

Comments
 (0)