当前位置: 首页>>代码示例>>Python>>正文


Python PrettyFormatAny.form方法代码示例

本文整理汇总了Python中Modules.Utilities.debug_tools.PrettyFormatAny.form方法的典型用法代码示例。如果您正苦于以下问题:Python PrettyFormatAny.form方法的具体用法?Python PrettyFormatAny.form怎么用?Python PrettyFormatAny.form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules.Utilities.debug_tools.PrettyFormatAny的用法示例。


在下文中一共展示了PrettyFormatAny.form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_01_FindXml

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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))
开发者ID:,项目名称:,代码行数:10,代码来源:

示例2: test_03_AddrLists

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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'))
开发者ID:,项目名称:,代码行数:12,代码来源:

示例3: test_04_Interfaces

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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))
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: test_01_Interface

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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))
开发者ID:,项目名称:,代码行数:12,代码来源:

示例5: test_03_AllLogins

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例6: test_02_OneLogin

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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)
开发者ID:,项目名称:,代码行数:13,代码来源:

示例7: test_06_OneController

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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))
开发者ID:,项目名称:,代码行数:28,代码来源:

示例8: _decode_weather

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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
开发者ID:,项目名称:,代码行数:9,代码来源:

示例9: test_01_OneInterface

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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')
开发者ID:,项目名称:,代码行数:9,代码来源:

示例10: test_03_OneNode

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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')
开发者ID:,项目名称:,代码行数:9,代码来源:

示例11: test_01_write_house_xml

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: test_03_AllPools

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例13: test_04_Web

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例14: test_02_AddrFamilyName

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
    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')
开发者ID:,项目名称:,代码行数:19,代码来源:

示例15: test_02_AllInterfaces

# 需要导入模块: from Modules.Utilities.debug_tools import PrettyFormatAny [as 别名]
# 或者: from Modules.Utilities.debug_tools.PrettyFormatAny import form [as 别名]
 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.')
开发者ID:,项目名称:,代码行数:10,代码来源:


注:本文中的Modules.Utilities.debug_tools.PrettyFormatAny.form方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。