def test_many_failures_wrap(self):
        res = self.kernel_session.evaluate_wrap(
            'ImportString["[1,2", "RawJSON"]; 1/0')
        self.assertFalse(res.success)
        expected_msgs = [
            'Expecting end of array or a value separator.',
            "An error occurred near character 'EOF', at line 1:6",
            'Infinite expression Power[0, -1] encountered.'
        ]
        expected_msgs_name = [
            wl.MessageName(wl.Import, 'jsonarraymissingsep'),
            wl.MessageName(wl.Import, 'jsonhintposandchar'),
            wl.MessageName(wl.Power, 'infy')
        ]

        expected_tuples = list(zip(expected_msgs_name, expected_msgs))

        self.assertListEqual(res.messages, expected_msgs)
        self.assertListEqual(list(res.iter_messages()), expected_msgs)

        self.assertListEqual(res.messages_name, expected_msgs_name)
        self.assertListEqual(list(res.iter_messages_name()),
                             expected_msgs_name)

        self.assertListEqual(list(res.iter_messages_tuple()), expected_tuples)
    def test_many_failures_wrap_async(self):
        future = self.kernel_session.evaluate_wrap_future(
            'ImportString["[1,2", "RawJSON"]; 1/0'
        )
        res = future.result(timeout=2)
        self.assertFalse(res.success)
        expected_msgs = (
            "Expecting end of array or a value separator.",
            "An error occurred near character 'EOF', at line 1:6",
            "Infinite expression Power[0, -1] encountered.",
        )
        expected_msgs_name = (
            wl.MessageName(wl.Import, "jsonarraymissingsep"),
            wl.MessageName(wl.Import, "jsonhintposandchar"),
            wl.MessageName(wl.Power, "infy"),
        )
        expected_tuples = tuple(zip(expected_msgs_name, expected_msgs))

        self.assertEqual(res.messages, expected_msgs)
        self.assertEqual(tuple(res.iter_messages()), expected_msgs)

        self.assertEqual(res.messages_name, expected_msgs_name)
        self.assertEqual(tuple(res.iter_messages_name()), expected_msgs_name)

        self.assertEqual(tuple(res.iter_messages_tuple()), expected_tuples)
 def test_one_eval_many_msg_wrap(self):
     res = self.kernel_session.evaluate_wrap(
         'ImportString["[1,2", "RawJSON"]')
     self.assertFalse(res.success)
     expected_msgs = [
         (wl.MessageName(wl.Import, 'jsonarraymissingsep'),
          'Expecting end of array or a value separator.'),
         (wl.MessageName(wl.Import, 'jsonhintposandchar'),
          "An error occurred near character 'EOF', at line 1:6")
     ]
     self.assertListEqual(list(res.iter_messages_tuple()), expected_msgs)