diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-03-12 21:57:18 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-03-12 21:57:18 (GMT) |
commit | 48d578c02a98dfd339afc1f8c86dafde31a7e994 (patch) | |
tree | 396326a6a77727ecaf4f35a3aeecc3cfc275e32a /Lib/aifc.py | |
parent | c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b (diff) | |
parent | 85769539a3b4b229c2a4303653d125f323c5df8c (diff) | |
download | cpython-48d578c02a98dfd339afc1f8c86dafde31a7e994.zip cpython-48d578c02a98dfd339afc1f8c86dafde31a7e994.tar.gz cpython-48d578c02a98dfd339afc1f8c86dafde31a7e994.tar.bz2 |
#13394: add more tests for the aifc module and use warnings.warn instead of print. Patch by Oleg Plakhotnyuk.
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r-- | Lib/aifc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py index 775f39c..ec4f822 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -136,6 +136,7 @@ writeframesraw. import struct import builtins +import warnings __all__ = ["Error", "open", "openfp"] @@ -440,7 +441,7 @@ class Aifc_read: kludge = 0 if chunk.chunksize == 18: kludge = 1 - print('Warning: bad COMM chunk size') + warnings.warn('Warning: bad COMM chunk size') chunk.chunksize = 23 #DEBUG end self._comptype = chunk.read(4) @@ -484,11 +485,10 @@ class Aifc_read: # a position 0 and name '' self._markers.append((id, pos, name)) except EOFError: - print('Warning: MARK chunk contains only', end=' ') - print(len(self._markers), end=' ') - if len(self._markers) == 1: print('marker', end=' ') - else: print('markers', end=' ') - print('instead of', nmarkers) + w = ('Warning: MARK chunk contains only %s marker%s instead of %s' % + (len(self._markers), '' if len(self._markers) == 1 else 's', + nmarkers)) + warnings.warn(w) class Aifc_write: # Variables used in this class: |