def test_zset(self):
        zs = self.db.ZSet('zset_obj')
        zs.clear()

        zs.add('charlie', 31, 'huey', 3, 'mickey', 6, 'zaizee', 3, 'nuggie', 0)
        self.assertEqual(zs[1], ['huey'])
        self.assertEqual(zs[1, True], [('huey', 3)])

        self.assertEqual(
            zs[:],
            ['nuggie', 'huey', 'zaizee', 'mickey', 'charlie'])
        self.assertEqual(zs[:2], ['nuggie', 'huey'])
        self.assertEqual(zs[1:3, True], [('huey', 3), ('zaizee', 3)])
        self.assertEqual(zs['huey':'charlie'], ['huey', 'zaizee', 'mickey'])

        self.assertEqual(len(zs), 5)
        self.assertTrue(zs in 'charlie')
        self.assertFalse('xx' in zs)

        self.assertEqual(zs.score('charlie'), 31.)
        self.assertIsNone(zs.score('xx'))

        self.assertEqual(zs.rank('mickey'), 3)
        self.assertIsNone(zs.rank('xx'))

        self.assertEqual(zs.count(0, 5), 3)
        self.assertEqual(zs.count(6, 31), 2)
        self.assertEqual(zs.count(6, 30), 1)

        zs.incr('mickey')
        self.assertEqual(zs.score('mickey'), 7.)

        self.assertEqual(zs.range_by_score(0, 5), ['nuggie', 'huey', 'zaizee'])

        zs.remove('nuggie')
        self.assertEqual(zs[:2], ['huey', 'zaizee'])

        del zs['mickey']
        self.assertEqual(zs[:], ['huey', 'zaizee', 'charlie'])
        self.assertEqual(len(zs), 3)

        zs.remove_by_score(2, 4)
        self.assertEqual(zs[:], ['charlie'])

        zs.add('huey', 4, 'zaizee', 3, 'beanie', 8)
        zs.remove_by_rank(2)
        self.assertEqual(zs[:], ['zaizee', 'huey', 'charlie'])

        self.assertRaises(KeyError, lambda: zs['xx':])

        z1 = self.db.ZSet('z1')
        z2 = self.db.ZSet('z2')
        z1.add(1, 1, 2, 2, 3, 3)
        z2.add(3, 3, 4, 4, 5, 5)
        z3 = z1.unionstore('z3', z2)
        self.assertEqual(z3[:], ['1', '2', '4', '5', '3'])

        z3 = z1.interstore('z3', z2)
        self.assertEqual(z3[:], ['3'])
dataset/ETHPy150Open coleifer/walrus/walrus/tusks/helpers.py/TestHelper.test_zset/swapped operands of `in`