#!/usr/bin/env python
"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/qp/lib/test/utest_util.py $
$Id: utest_util.py 30554 2008-03-10 17:43:53Z dbinger $
"""
from qp.lib.util import import_object, randbytes, rand_int, rand_str
from sancho.utest import UTest

class Test(UTest):

    def check_import_object(self):
        import sys
        assert sys is import_object('sys')
        assert UTest is import_object('sancho.utest.UTest')

    def check_rand(self):
        for x in range(1,100):
            assert 0 <= rand_int(x) < 2 ** x
            assert type(rand_str(x)) is str
            randbytes(x)

if __name__ == '__main__':
    Test()
