dhamaniasad / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
2 stars 1 forks source link

EasyID3 RegisterTXXXKey() exception : ValueError: max() arg is an empty sequence #135

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Trying to set easyid3 tag to an empty string may result in such exception:
ValueError: max() arg is an empty sequence

To reproduce, just add following test to tests/test_easyid3.py:

    def test_txxx_set_get_empty(self):
        self.failIf("asin" in self.id3.keys())
        self.id3["asin"] = ""
        self.failUnless("asin" in self.id3.keys())
        self.failUnlessEqual(self.id3["asin"], [""])
        self.failUnless("TXXX:ASIN" in self.id3._EasyID3__id3)

This test should fail in "mutagen/easyid3.py", line 149, in setter
    if max(v) > u'\x7f':
which is trying to detect encoding.

When v is an empty string, max(v) will raise an exception.
Test should prolly be modified to:
    if v and max(v) > u'\x7f':

Original issue reported on code.google.com by lmonin....@gmail.com on 29 Jan 2013 at 12:44

GoogleCodeExporter commented 9 years ago

Original comment by reiter.christoph@gmail.com on 18 Feb 2013 at 11:24

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 61f91e4fa34a.

Original comment by reiter.christoph@gmail.com on 18 Feb 2013 at 11:36

GoogleCodeExporter commented 9 years ago
Thanks for the detailed report

Original comment by reiter.christoph@gmail.com on 18 Feb 2013 at 11:38