mirror of
https://github.com/python/cpython.git
synced 2025-11-07 21:29:26 +00:00
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.
This commit is contained in:
parent
e4aeb7d1f1
commit
ad9a7c4489
1 changed files with 18 additions and 2 deletions
|
|
@ -85,8 +85,24 @@ class PlaySoundTest(unittest.TestCase):
|
||||||
return
|
return
|
||||||
|
|
||||||
def test_alias_nofallback(self):
|
def test_alias_nofallback(self):
|
||||||
self.assertRaises(RuntimeError, winsound.PlaySound, '!"$%&/(#+*',
|
# Note that this is not the same as asserting RuntimeError
|
||||||
winsound.SND_ALIAS | winsound.SND_NODEFAULT)
|
# 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):
|
def test_stopasync(self):
|
||||||
winsound.PlaySound(
|
winsound.PlaySound(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue