(original) (raw)

changeset: 79625:842276ae4a3f branch: 3.3 parent: 79257:83496b5e1916 user: Benjamin Peterson benjamin@python.org date: Tue Oct 09 11:14:59 2012 -0400 files: Lib/test/test_winsound.py description: compare with equality not identity (issue #16172) Patch from Serhiy Storchaka. diff -r 83496b5e1916 -r 842276ae4a3f Lib/test/test_winsound.py --- a/Lib/test/test_winsound.py Sat Sep 29 14:14:19 2012 -0400 +++ b/Lib/test/test_winsound.py Tue Oct 09 11:14:59 2012 -0400 @@ -16,16 +16,12 @@ try: # Ask the mixer API for the number of devices it knows about. # When there are no devices, PlaySound will fail. - if ctypes.windll.winmm.mixerGetNumDevs() is 0: + if ctypes.windll.winmm.mixerGetNumDevs() == 0: return False key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER, "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound)) - value = winreg.EnumValue(key, 0)[1] - if value is not "": - return True - else: - return False + return winreg.EnumValue(key, 0)[1] != "" except WindowsError: return False /benjamin@python.org