diff options
author | INADA Naoki <songofacandy@gmail.com> | 2012-06-19 13:55:14 +0900 |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2012-06-19 13:55:14 +0900 |
commit | 0b38e86534130f625cbea2f9446e8e52ef5f5a06 (patch) | |
tree | f2df0546370c82b735725a17b412e16c78ca302f /test/test_case.py | |
parent | 76f34667a02f461043a70d776ec05fc1f90bd9e9 (diff) | |
download | msgpack-python-0b38e86534130f625cbea2f9446e8e52ef5f5a06.tar.gz |
unify tests for py2 and py3
Diffstat (limited to 'test/test_case.py')
-rw-r--r-- | test/test_case.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/test/test_case.py b/test/test_case.py index 1cbc494..2f42316 100644 --- a/test/test_case.py +++ b/test/test_case.py @@ -40,7 +40,7 @@ def test_9(): def check_raw(overhead, num): - check(num + overhead, " " * num) + check(num + overhead, b" " * num) def test_fixraw(): check_raw(1, 0) @@ -75,31 +75,31 @@ def match(obj, buf): def test_match(): cases = [ - (None, '\xc0'), - (False, '\xc2'), - (True, '\xc3'), - (0, '\x00'), - (127, '\x7f'), - (128, '\xcc\x80'), - (256, '\xcd\x01\x00'), - (-1, '\xff'), - (-33, '\xd0\xdf'), - (-129, '\xd1\xff\x7f'), - ({1:1}, '\x81\x01\x01'), - (1.0, "\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00"), - ((), '\x90'), - (tuple(range(15)),"\x9f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"), - (tuple(range(16)),"\xdc\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"), - ({}, '\x80'), - (dict([(x,x) for x in range(15)]), '\x8f\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07\x08\x08\t\t\n\n\x0b\x0b\x0c\x0c\r\r\x0e\x0e'), - (dict([(x,x) for x in range(16)]), '\xde\x00\x10\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07\x08\x08\t\t\n\n\x0b\x0b\x0c\x0c\r\r\x0e\x0e\x0f\x0f'), + (None, b'\xc0'), + (False, b'\xc2'), + (True, b'\xc3'), + (0, b'\x00'), + (127, b'\x7f'), + (128, b'\xcc\x80'), + (256, b'\xcd\x01\x00'), + (-1, b'\xff'), + (-33, b'\xd0\xdf'), + (-129, b'\xd1\xff\x7f'), + ({1:1}, b'\x81\x01\x01'), + (1.0, b"\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00"), + ((), b'\x90'), + (tuple(range(15)),b"\x9f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"), + (tuple(range(16)),b"\xdc\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"), + ({}, b'\x80'), + (dict([(x,x) for x in range(15)]), b'\x8f\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07\x08\x08\t\t\n\n\x0b\x0b\x0c\x0c\r\r\x0e\x0e'), + (dict([(x,x) for x in range(16)]), b'\xde\x00\x10\x00\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06\x07\x07\x08\x08\t\t\n\n\x0b\x0b\x0c\x0c\r\r\x0e\x0e\x0f\x0f'), ] for v, p in cases: match(v, p) def test_unicode(): - assert_equal('foobar', unpacks(packs(u'foobar'))) + assert_equal(b'foobar', unpacks(packs('foobar'))) if __name__ == '__main__': main() |