# 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 datetime
import json
from copy import deepcopy
from bson.objectid import ObjectId
from turbo.util import escape,  basestring_type
from util import unittest




class EscapeTest(unittest.TestCase):

    def test_inc(self):
        pass

    def test_to_str(self):
        data = {
            'v1': 10,
            'v2': datetime.datetime.now(),
            'v3': ObjectId(),
            'v4': 'value',
        }

        self.assertTrue(isinstance(json.dumps(escape.to_str(
            [deepcopy(data) for i in range(10)])), basestring_type))
        self.assertTrue(isinstance(json.dumps(
            escape.to_str(deepcopy(data))), basestring_type))

    def test_to_str_encode(self):
        data = {
            'v1': 10,
            'v2': datetime.datetime.now(),
            'v3': ObjectId(),
            'v4': 'value',
        }


# 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/util_test.py
import datetime
import json
from copy import deepcopy
from bson.objectid import ObjectId
from turbo.util import escape,  basestring_type
from util import unittest





class EscapeTest(unittest.TestCase):

    def test_inc(self):
        pass

    def test_to_str(self):
        data = {
            'v1': 10,
            'v2': datetime.datetime.now(),
            'v3': ObjectId(),
            'v4': 'value',
        }

        self.assertTrue(isinstance(json.dumps(escape.to_str(
            [deepcopy(data) for i in range(10)])), basestring_type))
        self.assertTrue(isinstance(json.dumps(
            escape.to_str(deepcopy(data))), basestring_type))

    def test_to_str_encode(self):
        data = {
            'v1': 10,
            'v2': datetime.datetime.now(),
            'v3': ObjectId(),
            'v4': 'value',
        }


        v = escape.to_str(data)