summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-29 21:57:21 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-29 21:57:21 (GMT)
commita663121e10265bb4d05b715a262cb4c1d79da082 (patch)
tree483adf73f16198edfbb2ba6b277bc122a52f5314 /Lib
parent13f7723d8163f29465817e5aec17e8394b2c28ef (diff)
parent50451eb91232b0e90c677419db19ed7b33a698a9 (diff)
downloadcpython-a663121e10265bb4d05b715a262cb4c1d79da082.zip
cpython-a663121e10265bb4d05b715a262cb4c1d79da082.tar.gz
cpython-a663121e10265bb4d05b715a262cb4c1d79da082.tar.bz2
Issue #24326: Fixed audioop.ratecv() with non-default weightB argument.
Original patch by David Moore.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_audioop.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py
index 879adea..01ed18d 100644
--- a/Lib/test/test_audioop.py
+++ b/Lib/test/test_audioop.py
@@ -363,6 +363,9 @@ class TestAudioop(unittest.TestCase):
(b'', (-2, ((0, 0),))))
self.assertEqual(audioop.ratecv(datas[w], w, 1, 8000, 8000, None)[0],
datas[w])
+ self.assertEqual(audioop.ratecv(datas[w], w, 1, 8000, 8000, None, 1, 0)[0],
+ datas[w])
+
state = None
d1, state = audioop.ratecv(b'\x00\x01\x02', 1, 1, 8000, 16000, state)
d2, state = audioop.ratecv(b'\x00\x01\x02', 1, 1, 8000, 16000, state)
@@ -378,6 +381,20 @@ class TestAudioop(unittest.TestCase):
self.assertEqual(d, d0)
self.assertEqual(state, state0)
+ expected = {
+ 1: packs[1](0, 0x0d, 0x37, -0x26, 0x55, -0x4b, -0x14),
+ 2: packs[2](0, 0x0da7, 0x3777, -0x2630, 0x5673, -0x4a64, -0x129a),
+ 3: packs[3](0, 0x0da740, 0x377776, -0x262fca,
+ 0x56740c, -0x4a62fd, -0x1298c0),
+ 4: packs[4](0, 0x0da740da, 0x37777776, -0x262fc962,
+ 0x56740da6, -0x4a62fc96, -0x1298bf26),
+ }
+ for w in 1, 2, 3, 4:
+ self.assertEqual(audioop.ratecv(datas[w], w, 1, 8000, 8000, None, 3, 1)[0],
+ expected[w])
+ self.assertEqual(audioop.ratecv(datas[w], w, 1, 8000, 8000, None, 30, 10)[0],
+ expected[w])
+
def test_reverse(self):
for w in 1, 2, 3, 4:
self.assertEqual(audioop.reverse(b'', w), b'')