summaryrefslogtreecommitdiff
path: root/test/test_except.py
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2012-12-29 11:24:25 +0900
committerINADA Naoki <inada-n@klab.com>2012-12-29 11:24:25 +0900
commit593c832ab00372b4a44dd47de94e4c2546fc1193 (patch)
treea24b9b2454f4fe30c2262f7839ec66c286036de6 /test/test_except.py
parentd57e369258a388ee64ad900ee7e975da25ca36ec (diff)
downloadmsgpack-python-593c832ab00372b4a44dd47de94e4c2546fc1193.tar.gz
Use py.test instead of nosetests.
Diffstat (limited to 'test/test_except.py')
-rw-r--r--test/test_except.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/test/test_except.py b/test/test_except.py
index 35287df..361d4ea 100644
--- a/test/test_except.py
+++ b/test/test_except.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding: utf-8
-from nose.tools import *
+from pytest import raises
from msgpack import packb, unpackb
import datetime
@@ -12,28 +12,20 @@ class DummyException(Exception):
def test_raise_on_find_unsupported_value():
- assert_raises(TypeError, packb, datetime.datetime.now())
+ with raises(TypeError):
+ packb(datetime.datetime.now())
def test_raise_from_object_hook():
def hook(obj):
raise DummyException
- assert_raises(DummyException, unpackb, packb({}), object_hook=hook)
- assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}),
- object_hook=hook)
- assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}),
- object_pairs_hook=hook)
- assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}),
- object_hook=hook)
- assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}),
- object_pairs_hook=hook)
-
-
-@raises(ValueError)
-def test_invalidvalue():
- unpackb(b'\xd9\x97#DL_')
+ raises(DummyException, unpackb, packb({}), object_hook=hook)
+ raises(DummyException, unpackb, packb({'fizz': 'buzz'}), object_hook=hook)
+ raises(DummyException, unpackb, packb({'fizz': 'buzz'}), object_pairs_hook=hook)
+ raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}), object_hook=hook)
+ raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}), object_pairs_hook=hook)
-if __name__ == '__main__':
- from nose import main
- main()
+def test_invalidvalue():
+ with raises(ValueError):
+ unpackb(b'\xd9\x97#DL_')