def test_reader_and_writer(self): writer = Writer('./test_rw', encode_fn=dumps) writer.drop() writer.put('foo', 'bar') writer.put('egg', 'spam') reader = Reader('./test_rw', decode_fn=loads) value = reader.get('foo') self.assertEqual(value, 'bar') value = reader.get('egg') self.assertEqual(value, 'spam')
def test_reader_and_writer(self): writer = Writer('./test_rw', int_key=True) writer.drop() writer.put(1234, 'bar') writer.put(5678, 'spam') reader = Reader('./test_rw', int_key=True) value = reader.get(1234) self.assertEqual(value, 'bar') value = reader.get(5678) self.assertEqual(value, 'spam')