本文整理汇总了Python中Modules.Utilities.debug_tools.PrettyFormatAny类的典型用法代码示例。如果您正苦于以下问题:Python PrettyFormatAny类的具体用法?Python PrettyFormatAny怎么用?Python PrettyFormatAny使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PrettyFormatAny类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_FindXml
def test_01_FindXml(self):
""" Be sure that the XML contains the right stuff.
"""
self.assertEqual(self.m_xml.root.tag, 'PyHouse', 'Invalid XML - not a PyHouse XML config file')
self.assertEqual(self.m_xml.house_div.tag, 'HouseDivision', 'XML - No House Division')
print(PrettyFormatAny.form(self.m_pyhouse_obj, 'Pyhouse', 120))
print(PrettyFormatAny.form(self.m_pyhouse_obj.Computer, 'Pyhouse', 120))
print(PrettyFormatAny.form(self.m_pyhouse_obj.House, 'Pyhouse', 120))
示例2: test_03_AddrLists
def test_03_AddrLists(self):
"""
I don't know how to test the returned list for validity.
Uncomment the print to see what your computer returned.
"""
l_names = Interfaces.find_all_interface_names()
# On my laptop: returns 7 interfaces.
print(PrettyFormatAny.form(l_names, 'Address Lists'))
l_ret = Interfaces._find_addr_lists(l_names[0])
print(PrettyFormatAny.form(l_ret, 'Address Lists'))
示例3: test_04_Interfaces
def test_04_Interfaces(self):
l_int = Interfaces._list_interfaces()
for l_name in l_int:
l_ifa = Interfaces._list_ifaddresses(l_name)
print(PrettyFormatAny.form(l_ifa, 'A2-04 Interface Addresses', 170))
l_all = Interfaces._get_all_interfaces()
print(PrettyFormatAny.form(l_int, 'A2-04 Interfaces', 170))
for l_ix in l_all:
print('{} {}'.format(l_ix, PrettyFormatAny.form(l_all[l_ix], 'Interface', 170)))
print(PrettyFormatAny.form(l_all, 'A2-04 Interfaces', 170))
示例4: test_01_Interface
def test_01_Interface(self):
l_ctlr = self.m_xml.controller_sect[1]
l_device = ControllerData()
l_obj = lightingcoreAPI.read_core_lighting_xml(l_device, l_ctlr, self.m_version)
print(PrettyFormatAny.form(l_obj, 'L L'))
L_interface = usbXML.read_interface_xml(l_ctlr)
stuff_new_attrs(l_obj, L_interface)
print(PrettyFormatAny.form(l_obj, 'L L'))
self.assertEqual(l_obj.Vendor, int(TESTING_USB_VENDOR))
self.assertEqual(l_obj.Product, int(TESTING_USB_PRODUCT))
示例5: test_03_AllLogins
def test_03_AllLogins(self):
""" Read all login objects.
"""
l_xml = self.m_xml.web_sect
l_obj, l_count = webXml._read_all_logins(l_xml)
print(PrettyFormatAny.form(l_xml, 'XML'))
print(PrettyFormatAny.form(l_obj, 'All login'))
print(PrettyFormatAny.form(l_obj[0], 'All login'))
self.assertEqual(l_count, 2)
self.assertEqual(len(l_obj), 2)
示例6: test_02_OneLogin
def test_02_OneLogin(self):
""" Read one Login object.
"""
l_xml = self.m_xml.login_sect.find('Login')
l_obj = webXml._read_one_login(l_xml)
print(PrettyFormatAny.form(l_xml, 'XML'))
print(PrettyFormatAny.form(l_obj, 'One login'))
self.assertEqual(l_obj.Name, TESTING_LOGIN_NAME_0)
self.assertEqual(l_obj.LoginFullName, TESTING_LOGIN_FULL_NAME_0)
self.assertEqual(l_obj.LoginPasswordCurrent, TESTING_LOGIN_PASSWORD_0)
self.assertEqual(l_obj.LoginRole, TESTING_LOGIN_ROLE_0)
示例7: test_06_OneController
def test_06_OneController(self):
""" Read in the xml file and fill in the lights
"""
l_obj = Utility._read_one_controller_xml(self.m_pyhouse_obj, self.m_xml.controller, self.m_version)
print(PrettyFormatAny.form(l_obj, 'OneController', 100))
self.assertEqual(l_obj.Name, TESTING_CONTROLLER_NAME_0)
self.assertEqual(l_obj.Active, (TESTING_CONTROLLER_ACTIVE_0 == 'True'))
self.assertEqual(l_obj.LightingType, TESTING_CONTROLLER_TYPE_0)
self.assertEqual(l_obj.Comment, TESTING_DEVICE_COMMENT)
self.assertEqual(l_obj.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
self.assertEqual(l_obj.DeviceType, int(TESTING_DEVICE_TYPE))
self.assertEqual(l_obj.DeviceSubType, int(TESTING_DEVICE_SUBTYPE))
self.assertEqual(l_obj.RoomName, TESTING_DEVICE_ROOM_NAME)
self.assertEqual(l_obj.InterfaceType, TESTING_INTERFACE_TYPE_SERIAL)
self.assertEqual(l_obj.Port, TESTING_INTERFACE_PORT_SERIAL)
self.assertEqual(l_obj.BaudRate, int(TESTING_SERIAL_BAUD_RATE))
self.assertEqual(l_obj.ByteSize, int(TESTING_SERIAL_BYTE_SIZE))
self.assertEqual(l_obj.Parity, TESTING_SERIAL_PARITY)
self.assertEqual(l_obj.RtsCts, TESTING_SERIAL_RTS_CTS == 'True')
self.assertEqual(l_obj.StopBits, float(TESTING_SERIAL_STOP_BITS))
self.assertEqual(l_obj.Timeout, float(TESTING_SERIAL_TIMEOUT))
self.assertEqual(l_obj.XonXoff, TESTING_SERIAL_XON_XOFF == 'True')
self.assertEqual(l_obj.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
self.assertEqual(l_obj.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
self.assertEqual(l_obj.GroupList, TESTING_INSTEON_GROUP_LIST_0)
self.assertEqual(l_obj.GroupNumber, int(TESTING_INSTEON_GROUP_NUM_0))
示例8: _decode_weather
def _decode_weather(self, p_logmsg, p_topic, p_message):
p_logmsg += '\tWeather:\n'
l_temp = float(self._get_field(p_message, 'Temperature'))
p_logmsg += '\tName: {}\n'.format(self._get_field(p_message, 'Location'))
p_logmsg += '\tTemp: {} ({})'.format(l_temp, ((l_temp / 5.0) * 9.0) + 32.0)
p_logmsg += '\tWeather info {}'.format(PrettyFormatAny.form(p_message, 'Weather msg', 160))
return p_logmsg
示例9: test_01_OneInterface
def test_01_OneInterface(self):
l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
l_xml = nodesXml._write_one_interface_xml(l_interface)
print(PrettyFormatAny.form(l_xml, 'One Interface'))
self.assertEqual(l_xml.attrib['Name'], 'eth0')
self.assertEqual(l_xml.attrib['Key'], '0')
self.assertEqual(l_xml.attrib['Active'], 'True')
示例10: test_03_OneNode
def test_03_OneNode(self):
l_node = nodesXml._read_one_node_xml(self.m_xml.node)
l_xml = nodesXml._write_one_node_xml(l_node)
print(PrettyFormatAny.form(l_xml, 'All Interfaces'))
self.assertEqual(l_xml.attrib['Name'], 'pi-01')
self.assertEqual(l_xml.attrib['Key'], '0')
self.assertEqual(l_xml.attrib['Active'], 'True')
示例11: test_01_write_house_xml
def test_01_write_house_xml(self):
l_house_obj = houseXml.read_house_xml(self.m_pyhouse_obj)
self.m_pyhouse_obj.House = l_house_obj
l_xml = houseXml.write_house_xml(self.m_pyhouse_obj)
print(PrettyFormatAny.form(l_xml, 'XML'))
self.assertEqual(l_xml.tag, 'HouseDivision')
self.assertEqual(l_xml.attrib['Name'], TESTING_HOUSE_NAME)
示例12: test_03_AllPools
def test_03_AllPools(self):
""" Read all pool info
"""
l_obj = poolXml.read_all_pools_xml(self.m_pyhouse_obj)
print(PrettyFormatAny.form(l_obj, 'Pool'))
# print(PrettyFormatAny.form(l_obj[0], 'Pool'))
self.assertEqual(len(l_obj), 2)
示例13: test_04_Web
def test_04_Web(self):
""" Write All logins.
"""
l_xml = webXml.write_web_xml(self.m_pyhouse_obj)
print(PrettyFormatAny.form(l_xml, 'Web'))
self.assertEqual(l_xml.find('Port').text, TESTING_WEB_PORT)
self.assertEqual(l_xml.find('LoginSection/Login/FullName').text, TESTING_LOGIN_FULL_NAME_0)
示例14: test_02_AddrFamilyName
def test_02_AddrFamilyName(self):
"""
We are interested in:
IPv4 (AF_INET)
IPv6 (AF_INET6)
MAC (AF_LINK)
"""
l_ret = Interfaces._find_addr_family_name(17)
print(PrettyFormatAny.form(l_ret, 'B1-02 Address Lists'))
self.assertEqual(l_ret, 'AF_PACKET')
l_ret = Interfaces._find_addr_family_name(2)
print(PrettyFormatAny.form(l_ret, 'B1-02 Address Lists'))
self.assertEqual(l_ret, 'AF_INET')
l_ret = Interfaces._find_addr_family_name(23)
print(PrettyFormatAny.form(l_ret, 'B1-02 Address Lists'))
self.assertEqual(l_ret, 'AF_INET6')
示例15: test_02_AllInterfaces
def test_02_AllInterfaces(self):
l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
print(PrettyFormatAny.form(l_interfaces, 'Interfaces'))
self.assertEqual(len(l_interfaces), 3)
self.assertEqual(l_interfaces[0].Name, TESTING_NODES_INTERFACE_NAME_0_0, 'Bad Name')
self.assertEqual(l_interfaces[1].Name, TESTING_NODES_INTERFACE_NAME_0_1, 'Bad Name')
self.assertEqual(l_interfaces[2].Name, 'lo', 'Bad Name')
self.assertEqual(len(l_interfaces), 3, 'Wrong interface count.')