Skip to content

Commit

Permalink
fix incorrect raise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rossengeorgiev committed Apr 21, 2020
1 parent bacdc11 commit 5f116d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/test_binary_vdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ def test_dumps_unicode_alternative(self):
def test_dump_params_invalid(self):
with self.assertRaises(TypeError):
vdf.binary_dump([], BytesIO())
with self.assertRaises(TypeError):
vdf.binary_dump({}, b'aaaa')

def test_dumps_params_invalid(self):
with self.assertRaises(TypeError):
vdf.binary_dumps([])
with self.assertRaises(TypeError):
vdf.binary_dumps(b'aaaa')

def test_dumps_key_invalid_type(self):
Expand All @@ -94,14 +96,19 @@ def test_alternative_format(self):
def test_load_params_invalid(self):
with self.assertRaises(TypeError):
vdf.binary_load(b'aaaa')
with self.assertRaises(TypeError):
vdf.binary_load(1234)
with self.assertRaises(TypeError):
vdf.binary_load(BytesIO(b'aaaa'), b'bbbb')

def test_loads_params_invalid(self):
with self.assertRaises(TypeError):
vdf.binary_loads([])
with self.assertRaises(TypeError):
vdf.binary_loads(11111)
with self.assertRaises(TypeError):
vdf.binary_loads(BytesIO())
with self.assertRaises(TypeError):
vdf.binary_load(b'', b'bbbb')

def test_loads_unbalanced_nesting(self):
Expand Down
5 changes: 4 additions & 1 deletion tests/test_vdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ def tearDown(self):
self.f.close()

def test_dump_params_invalid(self):
# pretty/escaped only accept bool
with self.assertRaises(TypeError):
# pretty/escaped only accept bool
vdf.dump({'a': 1}, StringIO(), pretty=1)
with self.assertRaises(TypeError):
vdf.dumps({'a': 1}, pretty=1)
with self.assertRaises(TypeError):
vdf.dump({'a': 1}, StringIO(), escaped=1)
with self.assertRaises(TypeError):
vdf.dumps({'a': 1}, escaped=1)

def test_routine_dumps_asserts(self):
Expand Down

0 comments on commit 5f116d5

Please sign in to comment.