Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
ur_py_ctl
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Robotlab
ur_py_ctl
Commits
b835e687
Verified
Commit
b835e687
authored
3 years ago
by
Anton Tetov Johansson
Browse files
Options
Downloads
Patches
Plain Diff
fixed kwargs
parent
17a6b103
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#1699
failed
3 years ago
Stage: quality
Stage: tests
Stage: publish
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_urscript_commands.py
+43
-0
43 additions, 0 deletions
tests/test_urscript_commands.py
ur_py_ctl/urscript_commands.py
+1
-1
1 addition, 1 deletion
ur_py_ctl/urscript_commands.py
with
44 additions
and
1 deletion
tests/test_urscript_commands.py
+
43
−
0
View file @
b835e687
from
collections
import
OrderedDict
from
random
import
random
import
pytest
from
ur_py_ctl.urscript_commands
import
_add_whitespace
from
ur_py_ctl.urscript_commands
import
_get_conf
from
ur_py_ctl.urscript_commands
import
_get_func
from
ur_py_ctl.urscript_commands
import
_get_pose
from
ur_py_ctl.urscript_commands
import
move_to_conf
@pytest.fixture
()
...
...
@@ -26,6 +30,25 @@ def pose_str():
return
"
p[22.00000, 13.00000, 25.00000, 3.14000, 0.00000, 1.70000]
"
@pytest.fixture
()
def
kwargs_input_output
():
input_
=
OrderedDict
(
{
"
v
"
:
random
()
*
2
,
"
a
"
:
random
()
*
0.1
,
"
t
"
:
random
()
*
3
,
"
r
"
:
random
()
*
0.2
,
}
)
output
=
OrderedDict
()
for
key
,
value
in
input_
.
items
():
output
[
key
]
=
f
"
{
key
}
=
{
value
:
.
5
f
}
"
return
input_
,
output
def
test__add_whitespace
():
def
func
(
input_
):
return
input_
[::
-
1
]
...
...
@@ -58,3 +81,23 @@ def test__get_conf(conf_list, conf_str):
def
test__get_pose
(
pose_list
,
pose_str
):
assert
_get_pose
(
*
pose_list
)
==
pose_str
def
test_move_to_conf
(
conf_list
,
conf_str
):
ur_func
=
move_to_conf
(
conf_list
)
assert
ur_func
==
f
"
\t
movej(
{
conf_str
}
)
\n
"
def
test_move_to_conf_kwargs
(
conf_list
,
conf_str
,
kwargs_input_output
):
input_kwargs
,
output_kwargs
=
kwargs_input_output
ur_func
=
move_to_conf
(
conf_list
,
**
input_kwargs
)
assert
ur_func
==
f
"
\t
movej(
{
conf_str
}
,
{
'
,
'
.
join
(
output_kwargs
.
values
())
}
)
\n
"
ur_func
=
move_to_conf
(
conf_list
,
v
=
input_kwargs
[
"
v
"
],
t
=
input_kwargs
[
"
t
"
])
assert
(
ur_func
==
f
"
\t
movej(
{
conf_str
}
,
{
output_kwargs
[
'
v
'
]
}
,
{
output_kwargs
[
'
t
'
]
}
)
\n
"
)
This diff is collapsed.
Click to expand it.
ur_py_ctl/urscript_commands.py
+
1
−
1
View file @
b835e687
...
...
@@ -46,7 +46,7 @@ def _get_move_kwargs(**kwargs) -> str:
if
len
(
urscript_kwargs
)
==
0
:
return
""
else
:
return
"
,
"
.
join
(
kwargs
)
return
"
,
"
.
join
(
urscript_
kwargs
)
class
Motion
(
object
):
...
...
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