summaryrefslogtreecommitdiff
path: root/Lib/test/test_winsound.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-05-16 05:36:30 +0000
committerTim Peters <tim.peters@gmail.com>2004-05-16 05:36:30 +0000
commitad9a7c44896f4cc0e9139fcd5b18aad52fc506a8 (patch)
tree6b5fbf850d913d3c62f2b2f34b87ba47e10ee328 /Lib/test/test_winsound.py
parente4aeb7d1f1e1029133b2c722bd239a8cc18e8f47 (diff)
downloadcpython-git-ad9a7c44896f4cc0e9139fcd5b18aad52fc506a8.tar.gz
test_alias_nofallback(): Someone broke this test, after 2.3, by
converting it into assertRaises() form. Restored the 2.3 code, and explained why assertRaises() cannot be used instead.
Diffstat (limited to 'Lib/test/test_winsound.py')
-rw-r--r--Lib/test/test_winsound.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
index d9d2892a6e..77c432ac4a 100644
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -85,8 +85,24 @@ class PlaySoundTest(unittest.TestCase):
return
def test_alias_nofallback(self):
- self.assertRaises(RuntimeError, winsound.PlaySound, '!"$%&/(#+*',
- winsound.SND_ALIAS | winsound.SND_NODEFAULT)
+ # Note that this is not the same as asserting RuntimeError
+ # will get raised: you cannot convert this to
+ # self.assertRaises(...) form. The attempt may or may not
+ # raise RuntimeError, but it shouldn't raise anything other
+ # than RuntimeError, and that's all we're trying to test here.
+ # The MS docs aren't clear about whether the SDK PlaySound()
+ # with SND_ALIAS and SND_NODEFAULT will return True or False when
+ # the alias is unknown. On Tim's WinXP box today, it returns
+ # True (no exception is raised). What we'd really like to test
+ # is that no sound is played, but that requires first wiring an
+ # eardrum class into unittest <wink>.
+ try:
+ winsound.PlaySound(
+ '!"$%&/(#+*',
+ winsound.SND_ALIAS | winsound.SND_NODEFAULT
+ )
+ except RuntimeError:
+ pass
def test_stopasync(self):
winsound.PlaySound(