Did I find the right examples for you? yes no

All Samples(13)  |  Call(13)  |  Derive(0)  |  Import(0)

src/e/l/eliot-0.3.0/eliot/tests/test_output.py   eliot(Download)
        """
        logger = MemoryLogger()
        logger.write({'a': 'b'})
        logger.write({'c': 1})
        self.assertEqual(logger.messages, [{'a': 'b'}, {'c': 1}])
        """
        logger = MemoryLogger()
        logger.write({123: 'b'})
        self.assertRaises(TypeError, logger.validate)
 
        """
        logger = MemoryLogger()
        logger.write({b'\u1234'.encode("utf-8"): 'b'})
        logger.validate()
 
        """
        logger = MemoryLogger()
        logger.write({'\u1234'.encode("utf-16"): 'b'})
        self.assertRaises(UnicodeDecodeError, logger.validate)