Files
mongo/lang/python/tests/PackTest.py
Michael Cahill f141326e73 Added some Java and Python tests of packing and unpacking.
--HG--
branch : mjc
extra : transplant_source : %C1p%BB%21%11%9F%F7%07h%A9%AF7%B2%27%2A%DE%98_%BD%B4
2010-12-14 09:27:31 +11:00

27 lines
624 B
Python

#!/usr/bin/env python
#
# Copyright (c) 2010 WiredTiger. All rights reserved.
#
# Python unit tests for the wiredtiger.*pack* methods.
from wiredtiger import pack, unpack
try:
import unittest2 as unittest
except ImportError:
import unittest
class TestPacking(unittest.TestCase):
def setUp(self):
pass
def test_simple(self):
for b in (0, 10, 65):
self.assertEqual(pack('b', b), chr(b))
for b in (0, 10, 65, 255):
self.assertEqual(pack('B', b), chr(b))
self.assertEqual(pack('c', chr(b)), chr(b))
if __name__ == '__main__':
unittest.main()