diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2014-03-11 17:39:18 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2014-03-11 19:32:18 -0500 |
commit | 0c1fcd2b50908bda607fce70c796033e33832b11 (patch) | |
tree | 05af7c047cdb39229efd344bba4aa2198ea9105c /test/test-sms | |
parent | c54e4763f8f4f6239a778994cf68f077ad2b170d (diff) | |
download | ofono-0c1fcd2b50908bda607fce70c796033e33832b11.tar.bz2 |
test: Make print calls compatible with Python 3
Turn print calls into print() function calls and avoid using
comma-separated arguments, so that they work and look the same with
both Python 2 and 3.
Diffstat (limited to 'test/test-sms')
-rwxr-xr-x | test/test-sms | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/test/test-sms b/test/test-sms index 794d46a7..5c0bfbb6 100755 --- a/test/test-sms +++ b/test/test-sms @@ -20,29 +20,29 @@ def clear_screen(numlines=100): os.system('CLS') else: - print '\n' * numlines + print('\n' * numlines) def print_menu(): - print "Select test case" - print "-----------------------------------------------------------" - print "[0] Send SMS" - print "[1] Enable delivery reports" - print "[2] Disable delivery reports" - print "[3] Set Service Center Address" - print "[4] Set PS-only Bearer" - print "[5] Set CS-only Bearer" - print "[6] Set PS-preferred Bearer" - print "[7] Set CS-preferred Bearer" - print "[x] Exit" - print "-----------------------------------------------------------" + print("Select test case") + print("-----------------------------------------------------------") + print("[0] Send SMS") + print("[1] Enable delivery reports") + print("[2] Disable delivery reports") + print("[3] Set Service Center Address") + print("[4] Set PS-only Bearer") + print("[5] Set CS-only Bearer") + print("[6] Set PS-preferred Bearer") + print("[7] Set CS-preferred Bearer") + print("[x] Exit") + print("-----------------------------------------------------------") def print_send_sms_menu(): - print "Select SMS type" - print "-----------------------------------------------------------" - print "[1] Default SMS" - print "[2] Long SMS > 160 characters" - print "[3] SMS with national characters" - print "-----------------------------------------------------------" + print("Select SMS type") + print("-----------------------------------------------------------") + print("[1] Default SMS") + print("[2] Long SMS > 160 characters") + print("[3] SMS with national characters") + print("-----------------------------------------------------------") def message_delivery_report(sms, value): try: @@ -50,79 +50,79 @@ def message_delivery_report(sms, value): except dbus.DBusException, e: if value == 1: - print "Unable to activate Delivery Reports - FAIL" + print("Unable to activate Delivery Reports - FAIL") if value == 0: - print "Unable to deactivate Delivery Reports - FAIL" + print("Unable to deactivate Delivery Reports - FAIL") def message_service_center_address(sms, value): try: sms.SetProperty("ServiceCenterAddress",dbus.String(value)) except dbus.DBusException, e: - print "Unable to set correct Service Center Address - FAIL" + print("Unable to set correct Service Center Address - FAIL") def message_bearer(sms, value): try: sms.SetProperty("Bearer", dbus.String(value)) except dbus.DBusException, e: - print "Unable to set Bearer[%s] - FAIL" % (value) + print("Unable to set Bearer[%s] - FAIL" % (value)) def message_send(sms, number, value): sms.SendMessage(dbus.String(number), value) def property_changed(property, value): - print "[1]:Message Manager property %s changed to %s" %\ - (property, value) - print "[1]:press ENTER" + print("[1]:Message Manager property %s changed to %s" %\ + (property, value)) + print("[1]:press ENTER") def immediate_message(property, value): - print "[2]:Message Manager immediate message" - print "[2]:Text::%s" % (property) + print("[2]:Message Manager immediate message") + print("[2]:Text::%s" % (property)) for key in value.keys(): val = str(value[key]) - print "[2]:%s = %s" % (key, val) + print("[2]:%s = %s" % (key, val)) - print "[2]:press ENTER" + print("[2]:press ENTER") def incoming_message(property, value): - print "[3]:Message Manager incoming message" - print "[3]:Text::%s" % (property) + print("[3]:Message Manager incoming message") + print("[3]:Text::%s" % (property)) for key in value.keys(): val = str(value[key]) - print "[3]:%s = %s" % (key, val) + print("[3]:%s = %s" % (key, val)) - print "[3]:press ENTER" + print("[3]:press ENTER") def message_added(property, value): - print "[4]:Message Manager[Added]" - print "[4]:%s"% (property) + print("[4]:Message Manager[Added]") + print("[4]:%s"% (property)) for key in value.keys(): val = str(value[key]) - print "[4]:%s = %s" % (key, val) + print("[4]:%s = %s" % (key, val)) - print "[4]:press ENTER" + print("[4]:press ENTER") def message_removed(property): - print "[5]:Message Manager [removed]" - print "[5]: %s" % (property) - print "[5]:press ENTER" + print("[5]:Message Manager [removed]") + print("[5]: %s" % (property)) + print("[5]:press ENTER") def print_sms_properties(sms): global SCA properties = sms.GetProperties() - print "---------------------PROPERTIES----------------------------" + print("---------------------PROPERTIES----------------------------") for p in properties: if len(properties[p].__str__()) > 0: - print "%s Message Manager rule is: %s" %\ - (p, properties[p]) - print "------------------------------------------" \ - "-----------------" + print("%s Message Manager rule is: %s" %\ + (p, properties[p])) + print("------------------------------------------" \ + "-----------------") if p == "ServiceCenterAddress": SCA = properties[p] else: - print "%s Message Manager rule disabled" % (p) + print("%s Message Manager rule disabled" % (p)) def stdin_handler(fd, condition, sms, value, number): global lock @@ -210,7 +210,7 @@ def stdin_handler(fd, condition, sms, value, number): if __name__ == "__main__": if (len(sys.argv) < 3): - print "Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0]) + print("Usage: %s [modem] <phone_number> <test_message>" % (sys.argv[0])) sys.exit(1) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) |