test: Replace obsolete has_key() with "in"

In order to also work with Python 3
This commit is contained in:
Martin Pitt 2014-03-11 17:39:20 +01:00 committed by Denis Kenzior
parent 0393a41e35
commit 5bf5cf8ddd
2 changed files with 13 additions and 13 deletions

View File

@ -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))

View File

@ -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: