Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
88239ef8
Commit
88239ef8
authored
Aug 13, 2016
by
Ivan Smirnov
Browse files
Don't use unittest in tests (Python 2 compat)
parent
006d8b66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
example/example-numpy-dtypes.py
example/example-numpy-dtypes.py
+5
-3
No files found.
example/example-numpy-dtypes.py
View file @
88239ef8
#!/usr/bin/env python
#!/usr/bin/env python
from
__future__
import
print_function
from
__future__
import
print_function
import
unittest
import
numpy
as
np
import
numpy
as
np
from
example
import
(
from
example
import
(
create_rec_simple
,
create_rec_packed
,
create_rec_nested
,
print_format_descriptors
,
create_rec_simple
,
create_rec_packed
,
create_rec_nested
,
print_format_descriptors
,
...
@@ -14,8 +13,11 @@ from example import (
...
@@ -14,8 +13,11 @@ from example import (
def
check_eq
(
arr
,
data
,
dtype
):
def
check_eq
(
arr
,
data
,
dtype
):
np
.
testing
.
assert_equal
(
arr
,
np
.
array
(
data
,
dtype
=
dtype
))
np
.
testing
.
assert_equal
(
arr
,
np
.
array
(
data
,
dtype
=
dtype
))
unittest
.
TestCase
().
assertRaisesRegex
(
try
:
RuntimeError
,
'unsupported buffer format'
,
get_format_unbound
)
get_format_unbound
()
raise
Exception
except
RuntimeError
as
e
:
assert
'unsupported buffer format'
in
str
(
e
)
print_format_descriptors
()
print_format_descriptors
()
print_dtypes
()
print_dtypes
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment