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 try:
00051 from cStringIO import StringIO
00052 except ImportError:
00053 from io import StringIO
00054 buff = StringIO()
00055 m.serialize(buff)
00056 self.assertEquals(0, buff.tell())
00057 m.deserialize('')
00058
00059 def test_anymsg(self):
00060
00061
00062
00063
00064 try:
00065 from cStringIO import StringIO
00066 except ImportError:
00067 from io import StringIO
00068 import rospy
00069
00070 m = rospy.AnyMsg()
00071 try:
00072 m.serialize(StringIO())
00073 self.fail("AnyMsg should not allow serialization")
00074 except:
00075 pass
00076
00077 teststr = 'foostr-%s'%time.time()
00078 m.deserialize(teststr)
00079 self.assertEquals(teststr, m._buff)
00080
00081
00082 try:
00083 m = rospy.AnyMsg('foo')
00084 self.fail("AnyMsg ctor should not allow args")
00085 except: pass
00086
00087 def test_rospy_api(self):
00088 import rospy
00089
00090
00091
00092
00093 try:
00094 rospy.add_shutdown_hook
00095 self.fail("add_shutdown_hookshould not longer be top-level API")
00096 except AttributeError: pass
00097
00098 rospy.DEBUG
00099 rospy.INFO
00100 rospy.WARN
00101 rospy.ERROR
00102 rospy.FATAL
00103
00104 rospy.get_caller_id
00105 rospy.get_name
00106 rospy.get_master
00107 rospy.get_namespace
00108 rospy.get_published_topics
00109 rospy.get_node_uri
00110 rospy.get_ros_root
00111 rospy.get_time
00112 rospy.get_rostime
00113 rospy.init_node
00114 rospy.is_shutdown
00115 rospy.logdebug
00116 rospy.logerr
00117 rospy.logfatal
00118 rospy.loginfo
00119 rospy.logout
00120 rospy.logwarn
00121 rospy.logdebug_throttle
00122 rospy.logerr_throttle
00123 rospy.logfatal_throttle
00124 rospy.loginfo_throttle
00125 rospy.logwarn_throttle
00126 rospy.myargv
00127 rospy.on_shutdown
00128 rospy.parse_rosrpc_uri
00129 rospy.resolve_name
00130 rospy.remap_name
00131 rospy.signal_shutdown
00132 rospy.sleep
00133 rospy.spin
00134 rospy.wait_for_message
00135 rospy.wait_for_service
00136
00137 rospy.delete_param
00138 rospy.get_param
00139 rospy.get_param_names
00140 rospy.has_param
00141 rospy.set_param
00142 rospy.search_param
00143
00144 rospy.AnyMsg
00145 rospy.Duration
00146 rospy.Header
00147 rospy.MasterProxy
00148 rospy.Message
00149 rospy.Publisher
00150 rospy.Rate
00151 rospy.ROSException
00152 rospy.ROSInternalException
00153 rospy.ROSSerializationException
00154 rospy.ServiceException
00155 rospy.Service
00156 rospy.ServiceProxy
00157 rospy.SubscribeListener
00158 rospy.Subscriber
00159 rospy.Time
00160 rospy.TransportException
00161 rospy.TransportTerminated
00162 rospy.TransportInitError