New submission from Oleg Plakhotnyuk <oleg...@gmail.com>:

I've increased coverage of aifc.py by test_aifc.py:

before:
[1/1] test_aifc
lines   cov%   module   (path)
  560    63%   aifc   (/Users/family/Documents/code/python/repo/Lib/aifc.py)
...

after:
[1/1] test_aifc
lines   cov%   module   (path)
  561    82%   aifc   (/Users/family/Documents/code/python/repo/Lib/aifc.py)
...

I have also encountered couple of problems in aifc.py:
1. When using setmark() with string name to write to aiff file, you get 
Exception TypeError: "'str' does not support the buffer interface".
2. When using close() of Aifc_write object, it attempts to close it again in 
__del__() which ends with ValueError: write to closed file.

I propose following solutions to above problems in patch attached:
1. Use bytes type for mark names, because entire aifc library already uses 
bytes anyway.
2. Make file pointer check in close() and reset it after actually closing the 
file.

I don't think that these fixes will cause major backward compatibility 
problems, because with current version of aifc there is no way to write markers 
at all anyway.

I plan to increase test coverage of aifc.py further in subsequent patches. Just 
want to make it in several small steps :-)

Please provide any feedback regarding to what should I do to make this patch 
committed.

Thanks!

----------
components: Library (Lib), Tests
files: test_aifc.patch
keywords: patch
messages: 147550
nosy: Oleg.Plakhotnyuk
priority: normal
severity: normal
status: open
title: Patch to increase aifc lib test coverage with couple of minor fixes
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file23677/test_aifc.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to