当前位置: 首页>>代码示例>>Python>>正文


Python TarantoolServer.clean方法代码示例

本文整理汇总了Python中lib.tarantool_server.TarantoolServer.clean方法的典型用法代码示例。如果您正苦于以下问题:Python TarantoolServer.clean方法的具体用法?Python TarantoolServer.clean怎么用?Python TarantoolServer.clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.tarantool_server.TarantoolServer的用法示例。


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

示例1: TestSuite_Schema

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import clean [as 别名]

#.........这里部分代码省略.........
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 1)

    def test_05_02_index_name___number(self):
        self.con.flush_schema()
        index = self.sch.get_index("_index", 0)
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index("_index", 2)
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index("_space", 0)
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index("_space", 2)
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 1)

    def test_05_03_index_number_name__(self):
        self.con.flush_schema()
        index = self.sch.get_index(288, "primary")
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(288, "name")
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, "primary")
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, "name")
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 1)

    def test_05_04_index_number_number(self):
        self.con.flush_schema()
        index = self.sch.get_index(288, 0)
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(288, 2)
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, 0)
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, 2)
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 1)

    def test_06_index_cached(self):
        index = self.sch.get_index("_index", "primary")
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index("_index", 2)
        self.assertEqual(index.space.name, "_index")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, "primary")
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, "primary")
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, 2)
        self.assertEqual(index.space.name, "_space")
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, "name")
        self.assertEqual(len(index.parts), 1)

    @classmethod
    def tearDownClass(self):
        self.srv.stop()
        self.srv.clean()
开发者ID:valerylisay,项目名称:tarantool-python,代码行数:104,代码来源:test_schema.py

示例2: TestSuite_Schema

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import clean [as 别名]

#.........这里部分代码省略.........
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 1)

    def test_05_02_index_name___number(self):
        self.con.flush_schema()
        index = self.sch.get_index('_index', 0)
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index('_index', 2)
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index('_space', 0)
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index('_space', 2)
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 1)

    def test_05_03_index_number_name__(self):
        self.con.flush_schema()
        index = self.sch.get_index(288, 'primary')
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(288, 'name')
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, 'primary')
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, 'name')
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 1)

    def test_05_04_index_number_number(self):
        self.con.flush_schema()
        index = self.sch.get_index(288, 0)
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(288, 2)
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, 0)
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, 2)
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 1)

    def test_06_index_cached(self):
        index = self.sch.get_index('_index', 'primary')
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index('_index', 2)
        self.assertEqual(index.space.name, '_index')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 2)
        index = self.sch.get_index(280, 'primary')
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 0)
        self.assertEqual(index.name, 'primary')
        self.assertEqual(len(index.parts), 1)
        index = self.sch.get_index(280, 2)
        self.assertEqual(index.space.name, '_space')
        self.assertEqual(index.iid, 2)
        self.assertEqual(index.name, 'name')
        self.assertEqual(len(index.parts), 1)

    @classmethod
    def tearDownClass(self):
        self.srv.stop()
        self.srv.clean()
开发者ID:mkaplenko,项目名称:tarantool-python,代码行数:104,代码来源:test_schema.py

示例3: Request

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import clean [as 别名]

#.........这里部分代码省略.........
                sorted(
                    self.con.select('space_1', [0], index='secondary', offset=3, limit=2),
                    key = lambda x: x[0]),
                [[110, 0, 'tuple_110'],\
                [115, 0, 'tuple_115']]
            )

        select_req = self.con.select('space_1', [0], index='secondary')
        self.assertEqual(len(select_req), 99)
        for i in select_req:
            self.assertTrue(not (i[0] % 5))
            self.assertTrue(not i[1])
            self.assertTrue(i[2] == 'tuple_' + str(i[0]))

        # Check limit again.
        self.assertEqual(len(self.con.select('space_1', [0, 'tuple_20'], index='secondary', limit=0)), 0)
        self.assertEqual(len(self.con.select('space_1', [0], index='secondary', limit=0)), 0)
        self.assertEqual(len(self.con.select('space_1', [0], index='secondary', limit=100)), 99)
        self.assertEqual(len(self.con.select('space_1', [0], index='secondary', limit=50)), 50)

        # TODO: Check iterator_types

    def test_03_delete(self):
        # Check that delete works fine
        self.assertEqual(self.con.delete('space_1', 20), [[20, 0, 'tuple_20']])
        self.assertEqual(self.con.delete('space_1', [20]), [])
        self.assertEqual(self.con.select('space_1', [20], index='primary'), [])
        # Check that <index_id> field has no meaning, yet.
        with self.assertRaisesRegexp(tarantool.DatabaseError,
                '(19, .*)'):
                self.con.delete('space_1', [1, 'tuple_21'])
        self.assertEqual(self.con.select('space_1', [21], index='primary'), [[21, 1, 'tuple_21']])

    def test_04_replace(self):
        # Check replace that is Ok.
        self.assertEqual(self.con.replace('space_1', [2, 2, 'tuple_3']), [[2, 2, 'tuple_3']])
        self.assertEqual(self.con.select('space_1', 2), [[2, 2, 'tuple_3']])
        # Check replace that isn't Ok.
        with self.assertRaisesRegexp(tarantool.DatabaseError,
                '(39, .*)'):
            self.assertEqual(self.con.replace('space_1', [2, 2]), [[2, 2, 'tuple_2']])

    def test_05_ping(self):
        # Simple ping test
        # * No exceptions are raised
        # * Ping time > 0
        self.assertTrue(self.con.ping() > 0)
        self.assertEqual(self.con.ping(notime=True), "Success")

    def test_06_update(self):
        self.assertEqual(self.con.update('space_1', (2,), [('+', 1, 3)]),
                [[2, 5, 'tuple_3']])
        self.assertEqual(self.con.update('space_1', (2,), [('-', 1, 3)]),
                [[2, 2, 'tuple_3']])
        self.assertEqual(self.con.update('space_1', (2,), [(':', 2, 3, 2, 'lalal')]),
                [[2, 2, 'tuplalal_3']])
        self.assertEqual(self.con.update('space_1', (2,), [('!', 2, '1')]),
                [[2, 2, '1', 'tuplalal_3']])
        self.assertEqual(self.con.update('space_1', (2,), [('!', 2, 'oingo, boingo')]),
                [[2, 2, 'oingo, boingo', '1', 'tuplalal_3']])
        self.assertEqual(self.con.update('space_1', (2,), [('#', 2, 2)]),
                [[2, 2, 'tuplalal_3']])

    def test_07_call(self):
        self.assertEqual(self.con.call('json.decode', '[123, 234, 345]'), [[123, 234, 345]])
        self.assertEqual(self.con.call('json.decode', ['[123, 234, 345]']), [[123, 234, 345]])
        self.assertEqual(self.con.call('json.decode', ('[123, 234, 345]',)), [[123, 234, 345]])
        with self.assertRaisesRegexp(tarantool.DatabaseError,
                '(32, .*)'):
            self.con.call('json.decode')
        with self.assertRaisesRegexp(tarantool.DatabaseError,
                '(22, .*)'):
            self.con.call('json.decode', '{"hello": "world"}')
        ans = self.con.call('fiber.time')
        self.assertEqual(len(ans), 1)
        self.assertEqual(len(ans[0]), 1)
        self.assertIsInstance(ans[0][0], float)
        ans = self.con.call('fiber.time64')
        self.assertEqual(len(ans), 1)
        self.assertEqual(len(ans[0]), 1)
        self.assertIsInstance(ans[0][0], (int, long))
        ans = self.con.call('uuid.str')
        self.assertEqual(len(ans), 1)
        self.assertEqual(len(ans[0]), 1)
        self.assertIsInstance(ans[0][0], str)
#        ans = self.con.call('uuid.hex')
#        self.assertEqual(len(ans), 1)
#        self.assertEqual(len(ans[0]), 1)
#        self.assertIsInstance(ans[0][0], str)
#        with self.assertRaisesRegexp(tarantool.DatabaseError,
#                '(12345, \'lol, error\')'):
#            self.con.call('box.error', [12345, 'lol, error'])

        self.assertEqual(self.con.call('box.tuple.new', [1, 2, 3, 'fld_1']), [[1, 2, 3, 'fld_1']])
        self.assertEqual(self.con.call('box.tuple.new', 'fld_1'), [['fld_1']])

    @classmethod
    def tearDownClass(self):
        self.srv.stop()
        self.srv.clean()
开发者ID:ko91h,项目名称:tarantool-python,代码行数:104,代码来源:test_dml.py


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