def test_zset(self):
        params = {
            'zset_a': {
                'a': 1,
                'b': 2,
                'c': 3,
                'd': 4,
            },
            'zset_b': {
                'h': 11,
                'i': 12,
                'j': 13,
                'k': 14,
            },
            'zset_c': {
                'o': 21,
                'p': 22,
                'q': 23,
            },
            'zset_d': {
                'r': 31,
                's': 32,
                't': 33,
            },            
        }
        for k,v in params.items():
            a = self.client.multi_zset(k, **v)
            assert_equals(a, len(v))
        a = self.client.zlist('zset_ ', 'zset_z', 10)
        assert_items_equal(a,params.keys())
        a = self.client.zkeys('zset_b', 'h', 11, 20, 10)
        zset_b = params['zset_b'].copy()
        zset_b.pop('h')
        assert_items_equal(a,zset_b.keys())
        a = self.client.zscan('zset_a', 'a', 1, 3, 10)
        zset_a = params['zset_a'].copy()
        zset_a.pop('a')
        zset_a.pop('d')
        assert_dict_equal(a, zset_a)
        a = self.client.zrscan('zset_a', 'd', 4, 1, 10)
        zset_a['a'] = params['zset_a']['a']
        assert_dict_equal(a, zset_a)

        a = self.client.zrank('zset_a', 'a')
        assert_equals(a, 0)
        a = self.client.zrank('zset_a', 'b')
        assert_equals(a, 1)
        a = self.client.zrank('zset_a', 'c')
        assert_equals(a, 2)
        a = self.client.zrank('zset_a', 'd')
        assert_equals(a, 3)
        a = self.client.zrrank('zset_a', 'd')
        assert_equals(a, 0)
        a = self.client.zrrank('zset_a', 'c')
        assert_equals(a, 1)
        a = self.client.zrrank('zset_a', 'b')
        assert_equals(a, 2)
        a = self.client.zrrank('zset_a', 'a')
        assert_equals(a, 3)

        a = self.client.zrange('zset_b', 0, 2)
        zset_b = params['zset_b'].copy()
        zset_b.pop('j')
        zset_b.pop('k')
        assert_dict_equal(a, zset_b)

        a = self.client.zrange('zset_b', 2, 2)
        zset_b = params['zset_b'].copy()
        zset_b.pop('h')
        zset_b.pop('i')        
        assert_dict_equal(a, zset_b)

        a = self.client.zrrange('zset_b', 0, 2)
        zset_b = params['zset_b'].copy()
        zset_b.pop('h')
        zset_b.pop('i')        
        assert_dict_equal(a, zset_b)

        a = self.client.zrrange('zset_b', 2, 2)
        zset_b = params['zset_b'].copy()
        zset_b.pop('j')
        zset_b.pop('k')        
        assert_dict_equal(a, zset_b)                
        
        for k,v in params.items():
            a = self.client.multi_zget(k, *v.keys())
            assert_dict_equal(a, v)
        for k,v in params.items():
            d = self.client.multi_zdel(k, *v.keys())
            assert_equals(d, len(v))
        for k,v in params['zset_a'].items():
            a = self.client.zset('zset_a', k, v)
            assert_true(a)
        for k,v in params['zset_a'].items():
            a = self.client.zget('zset_a', k)
            assert_equals(a,v)
        for k,v in params['zset_a'].items():
            a = self.client.zdel('zset_a', k)
            assert_true(a)
        for k,v in params['zset_b'].items():
            a = self.client.zset('zset_b', k, v)
            assert_true(a)
        for k,v in params['zset_b'].items():
            a = self.client.zexists('zset_b', k)
            assert_true(a)
            a = self.client.zexists('zset_b', k+"1")
            assert_false(a)
        c = self.client.zsize('zset_b')
        assert_equals(c, len(params['zset_b']))
        c = self.client.zincr('zset_b', 'h', 3)
        assert_equals(c, params['zset_b']['h']+3)
        c = self.client.zdecr('zset_b', 'h', 5)
        assert_equals(c, 5+3-params['zset_b']['h'])        
        d = self.client.zclear('zset_b')
        assert_true(d)
dataset/ETHPy150Open wrongwaycn/ssdb-py/tests/test_client.py/TestClient.test_zset/swapped operands of `-`