Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph-python
Commits
1c9e8d88
Commit
1c9e8d88
authored
5 years ago
by
Guilhem Saurel
Browse files
Options
Downloads
Patches
Plain Diff
more explicit error message for dgpy.plug argument issues
thanks
@jviereck
parent
834ff2f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dynamic_graph/dynamic-graph-py.cc
+4
-2
4 additions, 2 deletions
src/dynamic_graph/dynamic-graph-py.cc
unitTesting/test_bindings.py
+4
-4
4 additions, 4 deletions
unitTesting/test_bindings.py
with
8 additions
and
6 deletions
src/dynamic_graph/dynamic-graph-py.cc
+
4
−
2
View file @
1c9e8d88
...
@@ -49,7 +49,8 @@ PyObject* plug(
...
@@ -49,7 +49,8 @@ PyObject* plug(
if
(
signalIn
==
NULL
)
{
if
(
signalIn
==
NULL
)
{
struct
module_state
*
st
=
GETSTATE
(
m
);
struct
module_state
*
st
=
GETSTATE
(
m
);
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
"dgpy.plug in argument must be a dynamic_graph.Signal, not a "
<<
PyCapsule_GetName
(
objIn
);
oss
<<
"dynamic_graph.plug(a, b): Argument 'b' must be of type 'dynamic_graph.Signal', but got "
<<
PyCapsule_GetName
(
objIn
);
PyErr_SetString
(
st
->
dgpyError
,
oss
.
str
().
c_str
());
PyErr_SetString
(
st
->
dgpyError
,
oss
.
str
().
c_str
());
return
NULL
;
return
NULL
;
}
}
...
@@ -58,7 +59,8 @@ PyObject* plug(
...
@@ -58,7 +59,8 @@ PyObject* plug(
if
(
signalOut
==
NULL
)
{
if
(
signalOut
==
NULL
)
{
struct
module_state
*
st
=
GETSTATE
(
m
);
struct
module_state
*
st
=
GETSTATE
(
m
);
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
oss
<<
"dgpy.plug out argument must be a dynamic_graph.Signal, not a "
<<
PyCapsule_GetName
(
objOut
);
oss
<<
"dynamic_graph.plug(a, b): Argument 'a' must be of type 'dynamic_graph.Signal', but got "
<<
PyCapsule_GetName
(
objOut
);
PyErr_SetString
(
st
->
dgpyError
,
oss
.
str
().
c_str
());
PyErr_SetString
(
st
->
dgpyError
,
oss
.
str
().
c_str
());
return
NULL
;
return
NULL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
unitTesting/test_bindings.py
+
4
−
4
View file @
1c9e8d88
...
@@ -4,6 +4,8 @@ import dynamic_graph as dg
...
@@ -4,6 +4,8 @@ import dynamic_graph as dg
from
custom_entity
import
CustomEntity
from
custom_entity
import
CustomEntity
ERR
=
"
dynamic_graph.plug(a, b): Argument
'
%s
'
must be of type
'
dynamic_graph.Signal
'
, but got dynamic_graph.Entity
"
class
BindingsTests
(
unittest
.
TestCase
):
class
BindingsTests
(
unittest
.
TestCase
):
def
test_bindings
(
self
):
def
test_bindings
(
self
):
...
@@ -20,14 +22,12 @@ class BindingsTests(unittest.TestCase):
...
@@ -20,14 +22,12 @@ class BindingsTests(unittest.TestCase):
# Check that we can't connect first.out to second
# Check that we can't connect first.out to second
with
self
.
assertRaises
(
dg
.
dgpyError
)
as
cm_in
:
with
self
.
assertRaises
(
dg
.
dgpyError
)
as
cm_in
:
dg
.
plug
(
first
.
signal
(
'
out_double
'
),
second
)
dg
.
plug
(
first
.
signal
(
'
out_double
'
),
second
)
self
.
assertEqual
(
str
(
cm_in
.
exception
),
self
.
assertEqual
(
str
(
cm_in
.
exception
),
ERR
%
'
b
'
)
"
dgpy.plug in argument must be a dynamic_graph.Signal, not a dynamic_graph.Entity
"
)
# Check that we can't connect first to second.in
# Check that we can't connect first to second.in
with
self
.
assertRaises
(
dg
.
dgpyError
)
as
cm_out
:
with
self
.
assertRaises
(
dg
.
dgpyError
)
as
cm_out
:
dg
.
plug
(
first
,
second
.
signal
(
'
in_double
'
))
dg
.
plug
(
first
,
second
.
signal
(
'
in_double
'
))
self
.
assertEqual
(
str
(
cm_out
.
exception
),
self
.
assertEqual
(
str
(
cm_out
.
exception
),
ERR
%
'
a
'
)
"
dgpy.plug out argument must be a dynamic_graph.Signal, not a dynamic_graph.Entity
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment