Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 import os
00035 import sys
00036 import struct
00037 import unittest
00038 import time
00039
00040
00041 class TestRospyApi(unittest.TestCase):
00042
00043 def test_msg(self):
00044
00045
00046
00047 import rospy
00048
00049 m = rospy.Message()
00050 from cStringIO import StringIO
00051 buff = StringIO()
00052 m.serialize(buff)
00053 self.assertEquals(0, buff.tell())
00054 m.deserialize('')
00055
00056 def test_anymsg(self):
00057
00058
00059
00060
00061 from cStringIO import StringIO
00062 import rospy
00063
00064 m = rospy.AnyMsg()
00065 try:
00066 m.serialize(StringIO())
00067 self.fail("AnyMsg should not allow serialization")
00068 except:
00069 pass
00070
00071 teststr = 'foostr-%s'%time.time()
00072 m.deserialize(teststr)
00073 self.assertEquals(teststr, m._buff)
00074
00075
00076 try:
00077 m = rospy.AnyMsg('foo')
00078 self.fail("AnyMsg ctor should not allow args")
00079 except: pass
00080
00081 def test_rospy_api(self):
00082 import rospy
00083
00084
00085
00086
00087 try:
00088 rospy.add_shutdown_hook
00089 self.fail("add_shutdown_hookshould not longer be top-level API")
00090 except AttributeError: pass
00091
00092 rospy.DEBUG
00093 rospy.INFO
00094 rospy.WARN
00095 rospy.ERROR
00096 rospy.FATAL
00097
00098 rospy.get_caller_id
00099 rospy.get_name
00100 rospy.get_master
00101 rospy.get_namespace
00102 rospy.get_published_topics
00103 rospy.get_node_uri
00104 rospy.get_ros_root
00105 rospy.get_time
00106 rospy.get_rostime
00107 rospy.init_node
00108 rospy.is_shutdown
00109 rospy.logdebug
00110 rospy.logerr
00111 rospy.logfatal
00112 rospy.loginfo
00113 rospy.logout
00114 rospy.logwarn
00115 rospy.myargv
00116 rospy.on_shutdown
00117 rospy.parse_rosrpc_uri
00118 rospy.resolve_name
00119 rospy.remap_name
00120 rospy.signal_shutdown
00121 rospy.sleep
00122 rospy.spin
00123 rospy.wait_for_message
00124 rospy.wait_for_service
00125
00126 rospy.delete_param
00127 rospy.get_param
00128 rospy.get_param_names
00129 rospy.has_param
00130 rospy.set_param
00131 rospy.search_param
00132
00133 rospy.AnyMsg
00134 rospy.Duration
00135 rospy.Header
00136 rospy.MasterProxy
00137 rospy.Message
00138 rospy.Publisher
00139 rospy.Rate
00140 rospy.ROSException
00141 rospy.ROSInternalException
00142 rospy.ROSSerializationException
00143 rospy.ServiceException
00144 rospy.Service
00145 rospy.ServiceProxy
00146 rospy.SubscribeListener
00147 rospy.Subscriber
00148 rospy.Time
00149 rospy.TransportException
00150 rospy.TransportTerminated
00151 rospy.TransportInitError