• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_base_class.TestBaseClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_base_class.TestBaseClass的典型用法代码示例。如果您正苦于以下问题:Python TestBaseClass类的具体用法?Python TestBaseClass怎么用?Python TestBaseClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestBaseClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_put_with_mixeddata_client_serializer_deserializer_with_spec_in_put

    def test_put_with_mixeddata_client_serializer_deserializer_with_spec_in_put(self):

        #    Invoke put() for mixed data with class and instance serialziers
        #    with a specification in put. Client one is called

        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {'hosts': hostlist,
                'serialization': (client_serialize_function,
                    client_deserialize_function)}
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        response = aerospike.set_serializer(serialize_function)
        response = aerospike.set_deserializer(deserialize_function)
        key = ('test', 'demo', 1)

        rec = {
            'map': {"key": "asd';q;'1';",
                    "pi": 3},
            'normal': 1234,
            'special': '[email protected]#@#$QSDAsd;as',
            'list': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8")],
            'bytes': bytearray("asd;as[d'as;d", "utf-8"),
            'nestedlist': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8"),
                           [1, bytearray("asd;as[d'as;d", "utf-8")]],
            'nestedmap': {
                "key": "asd';q;'1';",
                "pi": 314,
                "nest": {"pi1": 312,
                         "t": 1}
            },
        }

        res = client.put(key, rec, {}, {}, aerospike.SERIALIZER_USER)

        assert res == 0

        _, _, bins = client.get(key)


        assert bins == {
            'map': {"key": "asd';q;'1';",
                    "pi": 3},
            'normal': 1234,
            'special': '[email protected]#@#$QSDAsd;as',
            'list': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8")],
            'bytes': bytearray("asd;as[d'as;d", "utf-8"),
            'nestedlist': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8"),
                           [1, bytearray("asd;as[d'as;d", "utf-8")]],
            'nestedmap': {
                "key": "asd';q;'1';",
                "pi": 314,
                "nest": {"pi1": 312,
                         "t": 1}
            },
        }
        client.close()

        self.delete_keys.append(key)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:60,代码来源:test_user_serializer.py


示例2: setup_class

    def setup_class(cls):
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {'hosts': hostlist}
        if user == None and password == None:
            TestApply.client = aerospike.client(config).connect()
        else:
            TestApply.client = aerospike.client(config).connect(user, password)
        TestApply.skip_old_server = True
        versioninfo = TestApply.client.info('version')
        for keys in versioninfo:
            for value in versioninfo[keys]:
                if value != None:
                    versionlist = value[value.find("build") + 6:value.find("\n")].split(".")
                    if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6:
                        TestApply.skip_old_server = False

        policy = {}
        TestApply.client.index_integer_create('test', 'demo', 'age',
                                              'age_index', policy)
        policy = {}
        TestApply.client.index_integer_create('test', 'demo', 'age1',
                                              'age_index1', policy)

        policy = {}
        filename = "sample.lua"
        udf_type = 0

        status = TestApply.client.udf_put(filename, udf_type, policy)
        filename = "test_record_udf.lua"
        status = TestApply.client.udf_put(filename, udf_type, policy)
开发者ID:Kavec,项目名称:aerospike-client-python,代码行数:30,代码来源:test_apply.py


示例3: setup_class

    def setup_class(cls):

        print "setup class invoked..."
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {
                'hosts': hostlist
                }
        if user == None and password == None:
            TestLList.client = aerospike.client(config).connect()
        else:
            TestLList.client = aerospike.client(config).connect(user, password)

        TestLList.key1 = ('test', 'demo', 'integer_llist_ky')

        TestLList.llist_integer = TestLList.client.llist(TestLList.key1,
                'integer_bin')

        TestLList.key2 = ('test', 'demo', 'string_llist_ky')

        TestLList.llist_string = TestLList.client.llist(TestLList.key2,
                'string_bin')

        TestLList.key3 = ('test', 'demo', 'float_llist_ky')

        TestLList.llist_float = TestLList.client.llist(TestLList.key3,
                'float_bin')
开发者ID:dreamflychen,项目名称:aerospike-client-python,代码行数:26,代码来源:test_llist.py


示例4: test_with_class_serializer_and_instance_serializer_with_unset_serializer

    def test_with_class_serializer_and_instance_serializer_with_unset_serializer(self):
        """
            Invoke put() for mixed data record with python serializer.
        """
        aerospike.set_serializer((lambda v: json.dumps(v)))
        aerospike.set_deserializer((lambda v: json.loads(v)))
        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {
            'hosts': hostlist
        }
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        key = ('test', 'demo', 16)
        try:
            TestPythonSerializer.client.remove(key)
        except:
            pass

        rec = {'normal': 1234, 'tuple': (1,2,3)}

        aerospike.unset_serializers()
        try:
            res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER)
        except ClientError as exception:
            assert exception.code == -1
            assert exception.msg == "No serializer callback registered"
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:28,代码来源:test_zserializers.py


示例5: test_with_class_serializer_and_instance_serializer

    def test_with_class_serializer_and_instance_serializer(self):
        """
            Invoke put() for mixed data record with class and instance serializer.
        """
        aerospike.set_serializer((lambda v: json.dumps(v)))
        aerospike.set_deserializer((lambda v: json.loads(v)))
        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {
            'hosts': hostlist,
            'serialization': ((lambda v: marshal.dumps(v)), (lambda v: marshal.loads(v)))}
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        key = ('test', 'demo', 16)
        try:
            TestPythonSerializer.client.remove(key)
        except:
            pass

        rec = {'normal': 1234, 'tuple': (1,2,3)}
        res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER)

        assert res == 0

        _, _, bins = client.get(key)

        # tuples JSON-encode to a list, and we use this fact to check which
        # serializer ran:
        assert bins == {'normal': 1234, 'tuple': (1,2,3)}
        client.remove(key)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:31,代码来源:test_zserializers.py


示例6: test_with_unset_serializer_python_serializer

    def test_with_unset_serializer_python_serializer(self):
        """
            Invoke put() for mixed data record with python serializer and
            calling unset_serializers
        """
        aerospike.set_serializer((lambda v: json.dumps(v)))
        aerospike.set_deserializer((lambda v: json.loads(v)))
        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {
            'hosts': hostlist
        }
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        key = ('test', 'demo', 16)
        try:
            client.remove(key)
        except:
            pass

        rec = {'normal': 1234, 'tuple': (1,2,3)}

        aerospike.unset_serializers()
        res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)
        
        assert res == 0

        _, _, bins = client.get(key)

        # tuples JSON-encode to a list, and we use this fact to check which
        # serializer ran:
        assert bins == {'normal': 1234, 'tuple': (1,2,3)}
        client.remove(key)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:34,代码来源:test_zserializers.py


示例7: setup_method

    def setup_method(self, method):
        """
        Setup method.
        """
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {'hosts': hostlist}
        if user == None and password == None:
            self.client = aerospike.client(config).connect()
        else:
            self.client = aerospike.client(config).connect(user, password)

        for i in xrange(19):
            key = ('test', u'demo', i)
            rec = {'name': 'name%s' % (str(i)), 'age': i}
            self.client.put(key, rec)

        key = ('test', u'demo', 122)
        list = [{"op": aerospike.OPERATOR_APPEND,
                "bin": bytearray("asd;adk\0kj", "utf-8"),
                "val": u"john"}];
        self.client.operate(key, list)

        key = ('test', u'demo', 'ldt_key')
        self.llist_bin = self.client.llist(key, 'llist_key')
        self.llist_bin.add(10)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:25,代码来源:test_scan.py


示例8: test_builtin_with_instance_serializer_and_no_class_serializer

    def test_builtin_with_instance_serializer_and_no_class_serializer(self):

        #    Invoke put() for data record with builtin serializer and an
        #    instance serializer set
        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {
            'hosts': hostlist,
            'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v)))}
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        key = ('test', 'demo', 12)
        try:
            client.remove(key)
        except:
            pass

        rec = {'normal': 1234, 'tuple': (1,2,3)}

        res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON)

        assert res == 0

        _, _, bins = client.get(key)

        assert bins == {'normal': 1234, 'tuple': (1,2,3)}
        client.remove(key)
        client.close()
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:29,代码来源:test_zserializers.py


示例9: test_instance_serializer_and_no_class_serializer

    def test_instance_serializer_and_no_class_serializer(self):

        #    Invoke put() for record with no class serializer. There is an
        #    instance serializer
        hostlist, user, password = TestBaseClass.get_hosts()
        method_config = {
            'hosts': hostlist,
            'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v)))}
        if user == None and password == None:
            client = aerospike.client(method_config).connect()
        else:
            client = aerospike.client(method_config).connect(user, password)
        key = ('test', 'demo', 11)
        try:
            client.remove(key)
        except:
            pass

        rec = {'normal': 1234, 'tuple': (1,2,3)}

        res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER)

        assert res == 0

        _, _, bins = client.get(key)

        # tuples JSON-encode to a list, and we use this fact to check which
        # serializer ran:
        assert bins == {'normal': 1234, 'tuple': [1,2,3]}
        client.remove(key)
        client.close()
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:31,代码来源:test_zserializers.py


示例10: setup_class

    def setup_class(cls):
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {
            'hosts': hostlist,
            'lua':{'user_path': '/tmp/',
            'system_path':'../aerospike-client-c/lua/'}}
        if user == None and password == None:
            client = aerospike.client(config).connect()
        else:
            client = aerospike.client(config).connect(user, password)

        TestAggregate.skip_old_server = True
        versioninfo = client.info('version')
        for keys in versioninfo:
            for value in versioninfo[keys]:
                if value != None:
                    versionlist = value[value.find("build") + 6:value.find("\n")].split(".")
                    if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6:
                        TestAggregate.skip_old_server = False
        client.index_integer_create('test', 'demo', 'test_age',
                'test_demo_test_age_idx')
        client.index_integer_create('test', 'demo', 'age1', 'test_demo_age1_idx')
        time.sleep(2)

        filename = "stream_example.lua"
        udf_type = aerospike.UDF_TYPE_LUA
        status = client.udf_put(filename, udf_type)
        shutil.copyfile(filename, config['lua']['user_path'] +
            'stream_example.lua')
        client.close()
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:30,代码来源:test_aggregate.py


示例11: setup_class

    def setup_class(cls):
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {'hosts': hostlist}
        if user == None and password == None:
            client = aerospike.client(config).connect()
        else:
            client = aerospike.client(config).connect(user, password)

        client.index_integer_create('test', 'demo', 'test_age',
                                              'age_index')
        client.index_string_create('test', 'demo', 'addr',
                                             'addr_index')
        client.index_integer_create('test', 'demo', 'age1',
                                              'age_index1')
        client.index_list_create('test', 'demo', 'numeric_list',
                                           aerospike.INDEX_NUMERIC,
                                           'numeric_list_index')
        client.index_list_create('test', 'demo', 'string_list',
                                           aerospike.INDEX_STRING,
                                           'string_list_index')
        client.index_map_keys_create('test', 'demo', 'numeric_map',
                                               aerospike.INDEX_NUMERIC,
                                               'numeric_map_index')
        client.index_map_keys_create('test', 'demo', 'string_map',
                                               aerospike.INDEX_STRING,
                                               'string_map_index')
        client.index_map_values_create('test', 'demo', 'numeric_map',
                                                 aerospike.INDEX_NUMERIC,
                                                 'numeric_map_values_index')
        client.index_map_values_create('test', 'demo', 'string_map',
                                                 aerospike.INDEX_STRING,
                                                 'string_map_values_index')
        client.index_integer_create('test', None, 'test_age_none', 
                                                'age_index_none')
开发者ID:Kavec,项目名称:aerospike-client-python,代码行数:34,代码来源:test_query.py


示例12: setup_method

    def setup_method(self, method):
        """
        Setup method.
        """

        hostlist, user, password = TestBaseClass.get_hosts()
        config = {
            'hosts': hostlist,
            'lua':{'user_path': '/tmp/',
            'system_path':'../aerospike-client-c/lua/'}}
        if TestBaseClass.user == None and TestBaseClass.password == None:
            self.client = aerospike.client(config).connect()
        else:
            self.client = aerospike.client(config).connect(
                TestBaseClass.user, TestBaseClass.password)

        for i in xrange(5):
            key = ('test', 'demo', i)
            rec = {
                'name': 'name%s' % (str(i)),
                'addr': 'name%s' % (str(i)),
                'test_age': i,
                'no': i
            }
            self.client.put(key, rec)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:25,代码来源:test_aggregate.py


示例13: setup_class

    def setup_class(cls):
        """
        Setup method.
        """
        hostlist, user, password = TestBaseClass.get_hosts()
        config = {'hosts': hostlist}
        if user == None and password == None:
            TestOperate.client = aerospike.client(config).connect()
        else:
            TestOperate.client = aerospike.client(config).connect(user,
                                                                  password)
        config_no_typechecks = {'hosts': hostlist, 'strict_types': False}
        if user == None and password == None:
            TestOperate.client_no_typechecks = aerospike.client(config_no_typechecks).connect()
        else:
            TestOperate.client_no_typechecks = aerospike.client(config_no_typechecks).connect(user, password)

        TestOperate.skip_old_server = True
        versioninfo = TestOperate.client.info('version')
        for keys in versioninfo:
            for value in versioninfo[keys]:
                if value != None:
                    versionlist = value[value.find("build") + 6:value.find("\n")].split(".")
                    if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6:
                        TestOperate.skip_old_server = False
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:25,代码来源:test_operate.py


示例14: setup_class

 def setup_class(cls):
     """
     Setup method.
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {'hosts': hostlist}
     if user == None and password == None:
         TestExists.client = aerospike.client(config).connect()
     else:
         TestExists.client = aerospike.client(config).connect(user, password)
开发者ID:Kavec,项目名称:aerospike-client-python,代码行数:10,代码来源:test_exists.py


示例15: setup_class

 def setup_class(cls):
     """
     Setup method.
     """
     TestGetMany.hostlist, TestGetMany.user, TestGetMany.password = TestBaseClass.get_hosts()
     config = {"hosts": TestGetMany.hostlist}
     if TestGetMany.user == None and TestGetMany.password == None:
         TestGetMany.client = aerospike.client(config).connect()
     else:
         TestGetMany.client = aerospike.client(config).connect(TestGetMany.user, TestGetMany.password)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:10,代码来源:test_get_many.py


示例16: setup_class

 def setup_class(cls):
     """
         Setup class
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {"hosts": hostlist}
     if user == None and password == None:
         TestPut.client = aerospike.client(config).connect()
     else:
         TestPut.client = aerospike.client(config).connect(user, password)
开发者ID:ssatturi,项目名称:aerospike-client-python,代码行数:10,代码来源:test_put.py


示例17: setup_class

 def setup_class(cls):
     """
     Setup method.
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {'hosts': hostlist}
     if user == None and password == None:
         TestGeospatial.client = aerospike.client(config).connect()
     else:
         TestGeospatial.client = aerospike.client(config).connect(user, password)
     TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc", "loc_index")
开发者ID:pombredanne,项目名称:aerospike-client-python,代码行数:11,代码来源:test_geospatial.py


示例18: test_isconnected_positive

 def test_isconnected_positive(self):
     """
     Invoke is_connected() positive.
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {'hosts': hostlist}
     if user == None and password == None:
         self.client = aerospike.client(config).connect()
     else:
         self.client = aerospike.client(config).connect(user, password)
     assert self.client.is_connected() == True
     self.client.close()
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:12,代码来源:test_is_connected.py


示例19: setup_class

 def setup_class(cls):
     """
         Setup class
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {'hosts': hostlist}
     if user == None and password == None:
         TestUserSerializer.client = aerospike.client(config).connect()
     else:
         TestUserSerializer.client = aerospike.client(config).connect(user, password)
     response = aerospike.set_serializer(serialize_function)
     response = aerospike.set_deserializer(deserialize_function)
开发者ID:hirokikana,项目名称:aerospike-client-python,代码行数:12,代码来源:test_user_serializer.py


示例20: setup_class

 def setup_class(cls):
     """
     Setup class.
     """
     hostlist, user, password = TestBaseClass.get_hosts()
     config = {'hosts': hostlist}
     if user == None and password == None:
         TestGetRegistered.client = aerospike.client(config).connect()
     else:
         TestGetRegistered.client = aerospike.client(config).connect(
             user, password)
     policy = {'timeout': 5000}
     TestGetRegistered.client.udf_put(u"bin_lua.lua", 0, policy)
开发者ID:Fabma,项目名称:aerospike-client-python,代码行数:13,代码来源:test_get_udf.py



注:本文中的test_base_class.TestBaseClass类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python functions.insert_img函数代码示例发布时间:2022-05-27
下一篇:
Python test_base.TestBase类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap