Beispiel #1
0
 def parse_message_with_args(self, args_str):
     conn_id, m = parse.message('[1234567.890] [email protected]_message(' + args_str + ')')
     self.assertIsInstance(m, Message)
     self.assertEqual(m.timestamp, 0)
     self.assertEqual(m.obj.type, 'some_object')
     self.assertEqual(m.obj.id, 12)
     self.assertEqual(m.sent, False)
     self.assertEqual(m.name, 'some_message')
     return m.args
Beispiel #2
0
 def test_parse_out_message_no_args(self):
     conn_id, m = parse.message('[1234567.890]  -> [email protected]_message()')
     self.assertIsInstance(m, Message)
     self.assertEqual(m.timestamp, 0)
     self.assertEqual(m.obj.type, 'some_object')
     self.assertEqual(m.obj.id, 12)
     self.assertEqual(m.sent, True)
     self.assertEqual(m.name, 'some_message')
     self.assertEqual(m.args, ())
     self.assertEqual(m.destroyed_obj, None)
Beispiel #3
0
 def parse_arg(self, raw):
     conn_id, m = parse.message(
         '[1234567.890] [email protected]_message(' + raw + ')')
     self.assertEqual(len(m.args), 1)
     return m.args[0]
Beispiel #4
0
 def test_parse_trash_raises(self):
     with self.assertRaises(RuntimeError):
         m = parse.message('asfjgdsfk')
Beispiel #5
0
 def test_parse_empty_raises(self):
     with self.assertRaises(RuntimeError):
         m = parse.message('')
Beispiel #6
0
 def test_parse_message_timestamp_with_comma(self):
     parse.message('[1234567,890] [email protected]_message()')
     conn_id, m = parse.message('[1234588,390] [email protected]_message()')
     self.assertIsInstance(m, Message)
     self.assertAlmostEqual(m.timestamp, 20.5 / 1000)