# Path: turbo/util.py
# PY3 = sys.version_info >= (3,)
# _UTF8_TYPES = (bytes, type(None))
# _BASESTRING_TYPES = (basestring_type, type(None))
# def to_list_str(value, encode=None):
# def to_dict_str(origin_value, encode=None):
# def default_encode(v):
# def to_str(v, encode=None):
# def format_time(dt):
# def to_objectid(objid):
# def json_encode(data, **kwargs):
# def json_decode(data, **kwargs):
# def to_int(value, default=None):
# def to_float(value, default=None):
# def to_datetime(t, micro=False):
# def to_time(t, micro=False):
#     def __init__(self, module):
#     def __getattr__(self, name):
# def get_base_dir(currfile, dir_level_num=3):
# def join_sys_path(currfile, dir_level_num=3):
# def import_object(name, package_space=None):
# def camel_to_underscore(name):
# def remove_folder(path, foldername):
# def remove_file(path, filename):
# def remove_extension(path, extension):
# def build_index(model_list):
# def utf8(value):
# def to_basestring(value):
# def get_func_name(func):
# class Escape(object):


import copy
import logging
import time
from datetime import datetime
from bson.objectid import ObjectId
from turbo.util import escape as es, camel_to_underscore, basestring_type as basestring, unicode_type
from util import unittest
        now = datetime.now()
        objid = ObjectId()
        number = 10
        self.check_value_type(es.to_str(self.record))
        self.check_value_type(es.to_str(self.values))
        self.check_value_type(es.to_str(now))
        self.check_value_type(es.to_str(objid))
        self.check_value_type(es.to_str(number))

    def test_no_attribute(self):
        with self.assertRaises(AttributeError):
            es.create_objectid()

    def test_tobjectid(self):
        es.to_int('s')

    def test_json_encode(self):
        self.assertTrue(es.json_encode(
            es.to_str(self.values), indent=4) is not None)

    def test_json_decode(self):
        self.assertTrue(type(es.json_decode(
            es.json_encode(es.to_str(self.values), indent=4)
        )).__name__ == 'list'
        )

        # error test
        self.assertTrue(type(es.json_decode(
            es.json_encode(es.to_str(self.values), invlaid=4)
        )).__name__ == 'NoneType'

# Path: turbo/util.py
# PY3 = sys.version_info >= (3,)
# _UTF8_TYPES = (bytes, type(None))
# _BASESTRING_TYPES = (basestring_type, type(None))
# def to_list_str(value, encode=None):
# def to_dict_str(origin_value, encode=None):
# def default_encode(v):
# def to_str(v, encode=None):
# def format_time(dt):
# def to_objectid(objid):
# def json_encode(data, **kwargs):
# def json_decode(data, **kwargs):
# def to_int(value, default=None):
# def to_float(value, default=None):
# def to_datetime(t, micro=False):
# def to_time(t, micro=False):
#     def __init__(self, module):
#     def __getattr__(self, name):
# def get_base_dir(currfile, dir_level_num=3):
# def join_sys_path(currfile, dir_level_num=3):
# def import_object(name, package_space=None):
# def camel_to_underscore(name):
# def remove_folder(path, foldername):
# def remove_file(path, filename):
# def remove_extension(path, extension):
# def build_index(model_list):
# def utf8(value):
# def to_basestring(value):
# def get_func_name(func):
# class Escape(object):


# Path: tests/escape_test.py
import copy
import logging
import time
from datetime import datetime
from bson.objectid import ObjectId
from turbo.util import escape as es, camel_to_underscore, basestring_type as basestring, unicode_type
from util import unittest

        now = datetime.now()
        objid = ObjectId()
        number = 10
        self.check_value_type(es.to_str(self.record))
        self.check_value_type(es.to_str(self.values))
        self.check_value_type(es.to_str(now))
        self.check_value_type(es.to_str(objid))
        self.check_value_type(es.to_str(number))

    def test_no_attribute(self):
        with self.assertRaises(AttributeError):
            es.create_objectid()

    def test_tobjectid(self):
        es.to_int('s')

    def test_json_encode(self):
        self.assertTrue(es.json_encode(
            es.to_str(self.values), indent=4) is not None)

    def test_json_decode(self):
        self.assertTrue(type(es.json_decode(
            es.json_encode(es.to_str(self.values), indent=4)
        )).__name__ == 'list'
        )

        # error test
        self.assertTrue(type(es.json_decode(
            es.json_encode(es.to_str(self.values), invlaid=4)
        )).__name__ == 'NoneType'

        )