def test_simple_string_ops(self):
        self.assertTrue(self.db.set('name', 'charlie'))
        self.assertEqual(self.db.get('name'), 'charlie')
        self.assertIsNone(self.db.get('not-exist'))

        self.assertFalse(self.db.setnx('name', 'huey'))
        self.db.setnx('friend', 'zaizee')
        self.assertEqual(self.db['name'], 'charlie')
        self.assertEqual(self.db['friend'], 'zaizee')

        self.assertTrue(self.db.mset({'k1': 'v1', 'k2': 'v2'}))
        res = self.db.mget('k1', 'k2')
        self.assertEqual(res, ['v1', 'v2'])

        self.db.append('k1', 'xx')
        self.assertEqual(self.db['k1'], 'v1xx')

        del self.db['counter']
        self.assertEqual(self.db.incr('counter'), 1)
        self.assertEqual(self.db.incr('counter', 5), 6)
        self.assertEqual(self.db.decr('counter', 2), 4)

        self.assertEqual(self.db.getrange('name', 3, 5), 'rli')
        self.assertEqual(self.db.getset('k2', 'baze'), 'v2')
        self.assertEqual(self.db['k2'], 'baze')
        self.assertEqual(self.db.strlen('name'), 7)

        self.db['data'] = '\x07'
        self.assertEqual(self.db.bitcount('data'), 3)

        del self.db['name']
        self.assertIsNone(self.db.get('name'))
        self.assertRaises(KeyError, lambda: self.db['name'])

        self.assertFalse('name' in self.db)
        self.assertTrue('k1' in self.db)
dataset/ETHPy150Open coleifer/walrus/walrus/tusks/helpers.py/TestHelper.test_simple_string_ops/original