pylint work regarding rstrip arguments. closes #98

This commit is contained in:
jevans 2013-08-05 20:39:39 -04:00
commit 19f5ae6a46
3 changed files with 6 additions and 3 deletions

View file

@ -1792,7 +1792,7 @@ class XMLBox(Jp2kBox):
text = read_buffer.decode('utf-8') text = read_buffer.decode('utf-8')
# Strip out any trailing nulls, as they can foul up XML parsing. # Strip out any trailing nulls, as they can foul up XML parsing.
text = text.rstrip('\0') text = text.rstrip(chr(0))
try: try:
elt = ET.fromstring(text) elt = ET.fromstring(text)

View file

@ -57,7 +57,7 @@ def read_pgx(pgx_file):
header += chr(char[0]) header += chr(char[0])
header = header.rstrip() header = header.rstrip()
tokens = re.split('\s', header) tokens = re.split(r'\s', header)
if (tokens[1][0] == 'M') and (sys.byteorder == 'little'): if (tokens[1][0] == 'M') and (sys.byteorder == 'little'):
swapbytes = True swapbytes = True

View file

@ -7,6 +7,7 @@ import struct
import sys import sys
import tempfile import tempfile
import uuid import uuid
from xml.etree import cElementTree as ET
if sys.hexversion < 0x02070000: if sys.hexversion < 0x02070000:
import unittest2 as unittest import unittest2 as unittest
@ -623,6 +624,8 @@ class TestJp2k(unittest.TestCase):
self.assertEqual(jp2k.box[3].box_id, 'xml ') self.assertEqual(jp2k.box[3].box_id, 'xml ')
self.assertEqual(jp2k.box[3].offset, 77) self.assertEqual(jp2k.box[3].offset, 77)
self.assertEqual(jp2k.box[3].length, 36) self.assertEqual(jp2k.box[3].length, 36)
self.assertEqual(ET.tostring(jp2k.box[3].xml.getroot()),
b'<test>this is a test</test>')
@unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows")
def test_asoc_label_box(self): def test_asoc_label_box(self):