Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
9fd47121
Commit
9fd47121
authored
Jul 06, 2019
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test suite (pytest changes in ExceptionInfo class)
parent
8b90b1da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
tests/test_eigen.py
+2
-2
tests/test_local_bindings.py
+2
-2
tests/test_methods_and_attributes.py
+8
-8
tests/test_smart_ptr.py
+2
-1
No files found.
tests/test_eigen.py
View file @
9fd47121
...
@@ -679,10 +679,10 @@ def test_issue1105():
...
@@ -679,10 +679,10 @@ def test_issue1105():
# These should still fail (incompatible dimensions):
# These should still fail (incompatible dimensions):
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
m
.
iss1105_row
(
np
.
ones
((
7
,
1
)))
m
.
iss1105_row
(
np
.
ones
((
7
,
1
)))
assert
"incompatible function arguments"
in
str
(
excinfo
)
assert
"incompatible function arguments"
in
str
(
excinfo
.
value
)
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
m
.
iss1105_col
(
np
.
ones
((
1
,
7
)))
m
.
iss1105_col
(
np
.
ones
((
1
,
7
)))
assert
"incompatible function arguments"
in
str
(
excinfo
)
assert
"incompatible function arguments"
in
str
(
excinfo
.
value
)
def
test_custom_operator_new
():
def
test_custom_operator_new
():
...
...
tests/test_local_bindings.py
View file @
9fd47121
...
@@ -220,7 +220,7 @@ def test_cross_module_calls():
...
@@ -220,7 +220,7 @@ def test_cross_module_calls():
c
,
d
=
m
.
MixGL2
(
3
),
cm
.
MixGL2
(
4
)
c
,
d
=
m
.
MixGL2
(
3
),
cm
.
MixGL2
(
4
)
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
m
.
get_gl_value
(
c
)
m
.
get_gl_value
(
c
)
assert
"incompatible function arguments"
in
str
(
excinfo
)
assert
"incompatible function arguments"
in
str
(
excinfo
.
value
)
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
m
.
get_gl_value
(
d
)
m
.
get_gl_value
(
d
)
assert
"incompatible function arguments"
in
str
(
excinfo
)
assert
"incompatible function arguments"
in
str
(
excinfo
.
value
)
tests/test_methods_and_attributes.py
View file @
9fd47121
...
@@ -100,32 +100,32 @@ def test_properties():
...
@@ -100,32 +100,32 @@ def test_properties():
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
dummy
=
instance
.
def_property_writeonly
# noqa: F841 unused var
dummy
=
instance
.
def_property_writeonly
# noqa: F841 unused var
assert
"unreadable attribute"
in
str
(
excinfo
)
assert
"unreadable attribute"
in
str
(
excinfo
.
value
)
instance
.
def_property_writeonly
=
4
instance
.
def_property_writeonly
=
4
assert
instance
.
def_property_readonly
==
4
assert
instance
.
def_property_readonly
==
4
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
dummy
=
instance
.
def_property_impossible
# noqa: F841 unused var
dummy
=
instance
.
def_property_impossible
# noqa: F841 unused var
assert
"unreadable attribute"
in
str
(
excinfo
)
assert
"unreadable attribute"
in
str
(
excinfo
.
value
)
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
instance
.
def_property_impossible
=
5
instance
.
def_property_impossible
=
5
assert
"can't set attribute"
in
str
(
excinfo
)
assert
"can't set attribute"
in
str
(
excinfo
.
value
)
def
test_static_properties
():
def
test_static_properties
():
assert
m
.
TestProperties
.
def_readonly_static
==
1
assert
m
.
TestProperties
.
def_readonly_static
==
1
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
m
.
TestProperties
.
def_readonly_static
=
2
m
.
TestProperties
.
def_readonly_static
=
2
assert
"can't set attribute"
in
str
(
excinfo
)
assert
"can't set attribute"
in
str
(
excinfo
.
value
)
m
.
TestProperties
.
def_readwrite_static
=
2
m
.
TestProperties
.
def_readwrite_static
=
2
assert
m
.
TestProperties
.
def_readwrite_static
==
2
assert
m
.
TestProperties
.
def_readwrite_static
==
2
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
dummy
=
m
.
TestProperties
.
def_writeonly_static
# noqa: F841 unused var
dummy
=
m
.
TestProperties
.
def_writeonly_static
# noqa: F841 unused var
assert
"unreadable attribute"
in
str
(
excinfo
)
assert
"unreadable attribute"
in
str
(
excinfo
.
value
)
m
.
TestProperties
.
def_writeonly_static
=
3
m
.
TestProperties
.
def_writeonly_static
=
3
assert
m
.
TestProperties
.
def_readonly_static
==
3
assert
m
.
TestProperties
.
def_readonly_static
==
3
...
@@ -133,14 +133,14 @@ def test_static_properties():
...
@@ -133,14 +133,14 @@ def test_static_properties():
assert
m
.
TestProperties
.
def_property_readonly_static
==
3
assert
m
.
TestProperties
.
def_property_readonly_static
==
3
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
m
.
TestProperties
.
def_property_readonly_static
=
99
m
.
TestProperties
.
def_property_readonly_static
=
99
assert
"can't set attribute"
in
str
(
excinfo
)
assert
"can't set attribute"
in
str
(
excinfo
.
value
)
m
.
TestProperties
.
def_property_static
=
4
m
.
TestProperties
.
def_property_static
=
4
assert
m
.
TestProperties
.
def_property_static
==
4
assert
m
.
TestProperties
.
def_property_static
==
4
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
dummy
=
m
.
TestProperties
.
def_property_writeonly_static
dummy
=
m
.
TestProperties
.
def_property_writeonly_static
assert
"unreadable attribute"
in
str
(
excinfo
)
assert
"unreadable attribute"
in
str
(
excinfo
.
value
)
m
.
TestProperties
.
def_property_writeonly_static
=
5
m
.
TestProperties
.
def_property_writeonly_static
=
5
assert
m
.
TestProperties
.
def_property_static
==
5
assert
m
.
TestProperties
.
def_property_static
==
5
...
@@ -158,7 +158,7 @@ def test_static_properties():
...
@@ -158,7 +158,7 @@ def test_static_properties():
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
dummy
=
instance
.
def_property_writeonly_static
# noqa: F841 unused var
dummy
=
instance
.
def_property_writeonly_static
# noqa: F841 unused var
assert
"unreadable attribute"
in
str
(
excinfo
)
assert
"unreadable attribute"
in
str
(
excinfo
.
value
)
instance
.
def_property_writeonly_static
=
4
instance
.
def_property_writeonly_static
=
4
assert
instance
.
def_property_static
==
4
assert
instance
.
def_property_static
==
4
...
...
tests/test_smart_ptr.py
View file @
9fd47121
...
@@ -272,7 +272,8 @@ def test_smart_ptr_from_default():
...
@@ -272,7 +272,8 @@ def test_smart_ptr_from_default():
instance
=
m
.
HeldByDefaultHolder
()
instance
=
m
.
HeldByDefaultHolder
()
with
pytest
.
raises
(
RuntimeError
)
as
excinfo
:
with
pytest
.
raises
(
RuntimeError
)
as
excinfo
:
m
.
HeldByDefaultHolder
.
load_shared_ptr
(
instance
)
m
.
HeldByDefaultHolder
.
load_shared_ptr
(
instance
)
assert
"Unable to load a custom holder type from a default-holder instance"
in
str
(
excinfo
)
assert
"Unable to load a custom holder type from a "
\
"default-holder instance"
in
str
(
excinfo
.
value
)
def
test_shared_ptr_gc
():
def
test_shared_ptr_gc
():
...
...
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