test: Replace obsolete has_key() with "in"
authorMartin Pitt <martin.pitt@ubuntu.com>
Tue, 11 Mar 2014 16:39:20 +0000 (17:39 +0100)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 12 Mar 2014 00:33:04 +0000 (19:33 -0500)
In order to also work with Python 3

test/test-modem
test/test-network-registration

index e4dd6bd..7681094 100755 (executable)
@@ -24,39 +24,39 @@ if __name__ == "__main__":
 
        properties = modem.GetProperties()
 
-       if properties.has_key('Name'):
+       if 'Name' in properties:
                print("Name: %s" % (properties['Name']))
 
-       if properties.has_key('Manufacturer'):
+       if 'Manufacturer' in properties:
                print("Manufacturer: %s" % (properties['Manufacturer']))
 
-       if properties.has_key('Model'):
+       if 'Model' in properties:
                print("Model: %s" % (properties['Model']))
 
-       if properties.has_key('Revision'):
+       if 'Revision' in properties:
                print("Revision: %s" % (properties['Revision']))
 
-       if properties.has_key('Serial'):
+       if 'Serial' in properties:
                print("Serial: %s" % (properties['Serial']))
 
-       if properties.has_key('Powered'):
+       if 'Powered' in properties:
                print("Powered: %s" % (properties['Powered']))
 
-       if properties.has_key('Online'):
+       if 'Online' in properties:
                print("Online: %s" % (properties['Online']))
 
-       if properties.has_key('Lockdown'):
+       if 'Lockdown' in properties:
                print("Lockdown: %s" % (properties['Lockdown']))
 
-       if properties.has_key('Emergency'):
+       if 'Emergency' in properties:
                print("Emergency: %s" % (properties['Emergency']))
 
-       if properties.has_key('Features'):
+       if 'Features' in properties:
                print("Features:")
                for feature in properties["Features"]:
                        print("    [ %s ]" % (feature))
 
-       if properties.has_key('Interfaces'):
+       if 'Interfaces' in properties:
                print("Interfaces:")
                for interface in properties["Interfaces"]:
                        print("    [ %s ]" % (interface))
index 5d3f75e..9410ae6 100755 (executable)
@@ -47,11 +47,11 @@ if __name__ == "__main__":
        print("Status is: '%s', Operator Name is: '%s'" %\
                (props['Status'], props['Name']))
 
-       if props.has_key('LocationAreaCode') and props.has_key('CellId'):
+       if 'LocationAreaCode' in props and 'CellId' in props:
                print("Location: '%d', Cell: '%d'" %\
                        (props['LocationAreaCode'], props['CellId']))
 
-       if props.has_key('Technology'):
+       if 'Technology' in props:
                print("Technology: '%s'" % (props['Technology']))
 
        try: