Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a6f5bf23
Commit
a6f5bf23
authored
Mar 18, 2008
by
Trent Nelson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure this test passes even if there are no soundcards in the system. Backport from trunk r61242.
parent
756c6c8c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Lib/test/test_winsound.py
Lib/test/test_winsound.py
+16
-4
No files found.
Lib/test/test_winsound.py
View file @
a6f5bf23
...
@@ -8,6 +8,13 @@ import subprocess
...
@@ -8,6 +8,13 @@ import subprocess
class
BeepTest
(
unittest
.
TestCase
):
class
BeepTest
(
unittest
.
TestCase
):
# As with PlaySoundTest, incorporate the _have_soundcard() check
# into our test methods. If there's no audio device present,
# winsound.Beep returns 0 and GetLastError() returns 127, which
# is: ERROR_PROC_NOT_FOUND ("The specified procedure could not
# be found"). (FWIW, virtual/Hyper-V systems fall under this
# scenario as they have no sound devices whatsoever (not even
# a legacy Beep device).)
def
test_errors
(
self
):
def
test_errors
(
self
):
self
.
assertRaises
(
TypeError
,
winsound
.
Beep
)
self
.
assertRaises
(
TypeError
,
winsound
.
Beep
)
...
@@ -15,12 +22,17 @@ class BeepTest(unittest.TestCase):
...
@@ -15,12 +22,17 @@ class BeepTest(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
winsound
.
Beep
,
32768
,
75
)
self
.
assertRaises
(
ValueError
,
winsound
.
Beep
,
32768
,
75
)
def
test_extremes
(
self
):
def
test_extremes
(
self
):
winsound
.
Beep
(
37
,
75
)
if
_have_soundcard
():
winsound
.
Beep
(
32767
,
75
)
winsound
.
Beep
(
37
,
75
)
winsound
.
Beep
(
32767
,
75
)
else
:
self
.
assertRaises
(
RuntimeError
,
winsound
.
Beep
,
37
,
75
)
self
.
assertRaises
(
RuntimeError
,
winsound
.
Beep
,
32767
,
75
)
def
test_increasingfrequency
(
self
):
def
test_increasingfrequency
(
self
):
for
i
in
xrange
(
100
,
2000
,
100
):
if
_have_soundcard
():
winsound
.
Beep
(
i
,
75
)
for
i
in
xrange
(
100
,
2000
,
100
):
winsound
.
Beep
(
i
,
75
)
class
MessageBeepTest
(
unittest
.
TestCase
):
class
MessageBeepTest
(
unittest
.
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment