52 rospy.init_node(
'ns/node')
55 self.failIf(failed,
"init_node allowed '/' in name")
59 rospy.init_node(name=
None)
62 self.failIf(failed,
"init_node allowed None as name")
69 self.failIf(failed,
"init_node allowed empty string as name")
75 except rospy.ROSInitException:
77 self.failIf(failed,
"spin() should failed if not initialized")
82 from rospy.client
import myargv
84 self.assertEquals(args, sys.argv)
85 self.assertEquals([
'foo',
'bar',
'baz'], myargv([
'foo',
'bar',
'baz']))
86 self.assertEquals([
'-foo',
'bar',
'-baz'], myargv([
'-foo',
'bar',
'-baz']))
88 self.assertEquals([
'foo'], myargv([
'foo',
'bar:=baz']))
89 self.assertEquals([
'foo'], myargv([
'foo',
'-bar:=baz']))
95 from rospy.client
import load_command_line_node_params
97 assert {} == load_command_line_node_params([])
98 assert {} == load_command_line_node_params([
'a',
'b',
'c'])
99 assert {} == load_command_line_node_params([
'a:=b'])
100 assert {
'a':
'b'} == load_command_line_node_params([
'_a:=b'])
101 assert {
'a':
'b',
'foo':
'bar'} == load_command_line_node_params([
'_a:=b',
'blah',
'_foo:=bar',
'baz'])
103 assert {
'a': 1} == load_command_line_node_params([
'_a:=1'])
105 load_command_line_node_params([
'_a:=b:=c'])
106 except rospy.exceptions.ROSInitException:
109 if __name__ ==
'__main__':
110 rosunit.unitrun(
'test_rospy', sys.argv[0], TestRospyClient, coverage_packages=[
'rospy.client'])
def test_load_command_line_node_params(self)