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
7f3652e3
Commit
7f3652e3
authored
Jun 07, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8897: Fix sunau module, use bytes to write the header. Patch written by
Thomas Jollans.
parent
7eeb5b5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
1 deletion
+75
-1
Lib/sunau.py
Lib/sunau.py
+1
-1
Lib/test/test_sunau.py
Lib/test/test_sunau.py
+70
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/sunau.py
View file @
7f3652e3
...
...
@@ -299,7 +299,7 @@ class Au_write:
self
.
_nframeswritten
=
0
self
.
_datawritten
=
0
self
.
_datalength
=
0
self
.
_info
=
''
self
.
_info
=
b
''
self
.
_comptype
=
'ULAW'
# default is U-law
def
setnchannels
(
self
,
nchannels
):
...
...
Lib/test/test_sunau.py
0 → 100644
View file @
7f3652e3
from
test.support
import
run_unittest
,
TESTFN
import
unittest
import
os
import
sunau
nchannels
=
2
sampwidth
=
2
framerate
=
8000
nframes
=
100
class
SunAUTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
f
=
None
def
tearDown
(
self
):
if
self
.
f
is
not
None
:
self
.
f
.
close
()
try
:
os
.
remove
(
TESTFN
)
except
OSError
:
pass
def
test_lin
(
self
):
self
.
f
=
sunau
.
open
(
TESTFN
,
'w'
)
self
.
f
.
setnchannels
(
nchannels
)
self
.
f
.
setsampwidth
(
sampwidth
)
self
.
f
.
setframerate
(
framerate
)
self
.
f
.
setcomptype
(
'NONE'
,
'not compressed'
)
output
=
b'
\
xff
\
x00
\
x12
\
xcc
'
*
(
nframes
*
nchannels
*
sampwidth
//
4
)
self
.
f
.
writeframes
(
output
)
self
.
f
.
close
()
self
.
f
=
sunau
.
open
(
TESTFN
,
'rb'
)
self
.
assertEqual
(
nchannels
,
self
.
f
.
getnchannels
())
self
.
assertEqual
(
sampwidth
,
self
.
f
.
getsampwidth
())
self
.
assertEqual
(
framerate
,
self
.
f
.
getframerate
())
self
.
assertEqual
(
nframes
,
self
.
f
.
getnframes
())
self
.
assertEqual
(
'NONE'
,
self
.
f
.
getcomptype
())
self
.
assertEqual
(
self
.
f
.
readframes
(
nframes
),
output
)
self
.
f
.
close
()
def
test_ulaw
(
self
):
self
.
f
=
sunau
.
open
(
TESTFN
,
'w'
)
self
.
f
.
setnchannels
(
nchannels
)
self
.
f
.
setsampwidth
(
sampwidth
)
self
.
f
.
setframerate
(
framerate
)
self
.
f
.
setcomptype
(
'ULAW'
,
''
)
# u-law compression is lossy, therefore we can't expect non-zero data
# to come back unchanged.
output
=
b'
\
0
'
*
nframes
*
nchannels
*
sampwidth
self
.
f
.
writeframes
(
output
)
self
.
f
.
close
()
self
.
f
=
sunau
.
open
(
TESTFN
,
'rb'
)
self
.
assertEqual
(
nchannels
,
self
.
f
.
getnchannels
())
self
.
assertEqual
(
sampwidth
,
self
.
f
.
getsampwidth
())
self
.
assertEqual
(
framerate
,
self
.
f
.
getframerate
())
self
.
assertEqual
(
nframes
,
self
.
f
.
getnframes
())
self
.
assertEqual
(
'ULAW'
,
self
.
f
.
getcomptype
())
self
.
assertEqual
(
self
.
f
.
readframes
(
nframes
),
output
)
self
.
f
.
close
()
def
test_main
():
run_unittest
(
SunAUTest
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Misc/ACKS
View file @
7f3652e3
...
...
@@ -389,6 +389,7 @@ Orjan Johansen
Fredrik Johansson
Gregory K. Johnson
Simon Johnston
Thomas Jollans
Evan Jones
Jeremy Jones
Richard Jones
...
...
Misc/NEWS
View file @
7f3652e3
...
...
@@ -398,6 +398,9 @@ C-API
Library
-------
- Issue #8897: Fix sunau module, use bytes to write the header. Patch written
by Thomas Jollans.
- Issue #8899: time.struct_time now has class and atribute docstrings.
- Issue #6470: Drop UNC prefix in FixTk.
...
...
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