File: test_biffh.py

package info (click to toggle)
python-xlrd 2.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,832 kB
  • sloc: python: 7,531; makefile: 118; sh: 7
file content (23 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import unittest

from xlrd import biffh

if sys.version_info[0] >= 3:
    from io import StringIO
else:
    # Python 2.6+ does have the io module, but io.StringIO is strict about
    # unicode, which won't work for our test.
    from StringIO import StringIO


class TestHexDump(unittest.TestCase):
    def test_hex_char_dump(self):
        sio = StringIO()
        biffh.hex_char_dump(b"abc\0e\01", 0, 6, fout=sio)
        s = sio.getvalue()
        assert "61 62 63 00 65 01" in s, s
        assert "abc~e?" in s, s

if __name__=='__main__':
    unittest.main()