def print_table(events, devices, rooms): table = pt.PrettyTable([ "id", "timestamp", "deviceName", "roomName", "deviceType", "propertyName", "oldValue", "newValue"]) table.align["deviceName"] = 'l' for event in events: device_name, roomID = devices[event.deviceID] try: room_name = rooms[roomID] except KeyError: room_name = "Unassigned" table.add_row([ event.id, timestamp_to_iso(event.timestamp), "{}({})".format(room_name, roomID), "{}({})".format(device_name, event.deviceID), event.deviceType, event.propertyName, event.oldValue, event.newValue]) print(table)
def print_table(events, devices, rooms): table = pt.PrettyTable([ "id", "timestamp", "deviceName", "roomName", "deviceType", "propertyName", "oldValue", "newValue" ]) table.align["deviceName"] = 'l' for event in events: device_name, roomID = devices[event.deviceID] try: room_name = rooms[roomID] except KeyError: room_name = "Unassigned" table.add_row([ event.id, timestamp_to_iso(event.timestamp), "{}({})".format(room_name, roomID), "{}({})".format(device_name, event.deviceID), event.deviceType, event.propertyName, event.oldValue, event.newValue ]) print(table)
def test_timestamp_to_iso(self): self.assertEqual(timestamp.timestamp_to_iso(123123123), "1973-11-26 01:52:03")
def test_timestamp_to_iso(self): self.assertEqual( timestamp.timestamp_to_iso(123123123), "1973-11-26 01:52:03")