#!/usr/bin/env python
"""
open/DurusWorks/qp/lib/test/utest_util.py

"""
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()
