From 88239ef83d971587aa71ab670cb8138965455ce3 Mon Sep 17 00:00:00 2001 From: Ivan Smirnov Date: Sat, 13 Aug 2016 12:38:57 +0100 Subject: [PATCH] Don't use unittest in tests (Python 2 compat) --- example/example-numpy-dtypes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/example/example-numpy-dtypes.py b/example/example-numpy-dtypes.py index 7858acd4..4b833283 100644 --- a/example/example-numpy-dtypes.py +++ b/example/example-numpy-dtypes.py @@ -1,7 +1,6 @@ #!/usr/bin/env python from __future__ import print_function -import unittest import numpy as np from example import ( create_rec_simple, create_rec_packed, create_rec_nested, print_format_descriptors, @@ -14,8 +13,11 @@ from example import ( def check_eq(arr, data, dtype): np.testing.assert_equal(arr, np.array(data, dtype=dtype)) -unittest.TestCase().assertRaisesRegex( - RuntimeError, 'unsupported buffer format', get_format_unbound) +try: + get_format_unbound() + raise Exception +except RuntimeError as e: + assert 'unsupported buffer format' in str(e) print_format_descriptors() print_dtypes()