<commit_before>import unittest

from rongcloud.rongcloud import RongCloud

rc = RongCloud('8luwapkvucoil', 'y0icysjl4h3LWz')


class MessageTestCase(unittest.TestCase):

    def test_broadcast(self):
        from_user_id = 'AAA'
        object_name = 'RC:TxtMsg'
        content = {'content': 'hello', 'extra': 'helloExtra'}
        rep = rc.get_message().broadcast(from_user_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_send(self):
        from_user_id = 'BBB'
        to_user_id = 'AAA'
        object_name = 'RC:TxtMsg'
        content = {'content': 'hello', 'extra': '...'}
        rep = rc.get_message().get_private().send(from_user_id, to_user_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_recall(self):
        from_user_id = 'AAA'
        target_id = 'BBB'
        uid = '5FGT-7VA9-G4DD-4V5P'
        sent_time = 1507778882124
        rep = rc.get_message().get_private().recall(from_user_id, target_id, uid, sent_time)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_send_template(self):
        from_user_id = 'fromuser'
        to_user_ids = ['21', '22']
        object_name = 'RC:TxtMsg'
        values = [{'{c}': '1', '{d}': '2', '{e}': '3'}, {'{c}': '4', '{d}': '5', '{e}': '6'}]
        content = {'content': '{c}{d}{e}', 'extra': 'bb'}
        push_content = ['push{c}', 'push{c}']
        push_data = ['pushd', 'pushd']
        rep = rc.get_message().get_private().send_template(from_user_id, to_user_ids, object_name, values, content,
                                                           push_content, push_data)
        self.assertEqual(rep['code'], 200, rep)

    def test_group_send(self):
        from_user_id = 'AAA'
        to_group_id = 'Group_1'
        object_name = 'RC:TxtMsg'
        content = {
            'content': 'hello',
            'mentionedInfo': {
                'type': 2,
                'userIdList': ['123', '456'],
                'mentionedContent': '有人@你'
            }
        }
        rep = rc.get_message().get_group().send(from_user_id, to_group_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_group_send(self):
        from_user_id = 'AAA'
        to_group_id = 'Group_1'
        to_user_ids = ['21', '22']
        object_name = 'RC:TxtMsg'
        content = {
            'content': 'hello',
            'mentionedInfo': {
                'type': 2,
                'userIdList': ['123', '456'],
                'mentionedContent': '有人@你'
            }
        }
        rep = rc.get_message().get_group().send_direction(from_user_id, to_group_id, to_user_ids, object_name, content)
        self.assertEqual(rep['code'], 200, rep)
<commit_msg>测试用例修改<commit_after>import unittest

from rongcloud.rongcloud import RongCloud

rc = RongCloud('8luwapkvucoil', 'y0icysjl4h3LWz')


class MessageTestCase(unittest.TestCase):

    def test_broadcast(self):
        from_user_id = 'AAA'
        object_name = 'RC:TxtMsg'
        content = {'content': 'hello', 'extra': 'helloExtra'}
        rep = rc.get_message().broadcast(from_user_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_send(self):
        from_user_id = 'BBB'
        to_user_id = 'AAA'
        object_name = 'RC:TxtMsg'
        content = {'content': 'hello', 'extra': '...'}
        rep = rc.get_message().get_private().send(from_user_id, to_user_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_recall(self):
        from_user_id = 'AAA'
        target_id = 'BBB'
        uid = '5FGT-7VA9-G4DD-4V5P'
        sent_time = 1507778882124
        rep = rc.get_message().get_private().recall(from_user_id, target_id, uid, sent_time)
        self.assertEqual(rep['code'], 200, rep)

    def test_private_send_template(self):
        from_user_id = 'fromuser'
        to_user_ids = ['21', '22']
        object_name = 'RC:TxtMsg'
        values = [{'{c}': '1', '{d}': '2', '{e}': '3'}, {'{c}': '4', '{d}': '5', '{e}': '6'}]
        content = {'content': '{c}{d}{e}', 'extra': 'bb'}
        push_content = ['push{c}', 'push{c}']
        push_data = ['pushd', 'pushd']
        rep = rc.get_message().get_private().send_template(from_user_id, to_user_ids, object_name, values, content,
                                                           push_content, push_data)
        self.assertEqual(rep['code'], 200, rep)

    def test_group_send(self):
        from_user_id = 'AAA'
        to_group_id = 'Group_1'
        object_name = 'RC:TxtMsg'
        content = {
            'content': 'hello',
            'mentionedInfo': {
                'type': 2,
                'userIdList': ['123', '456'],
                'mentionedContent': '有人@你'
            }
        }
        rep = rc.get_message().get_group().send(from_user_id, to_group_id, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

    def test_group_send_direction(self):
        from_user_id = 'AAA'
        to_group_id = 'Group_1'
        to_user_ids = ['21', '22']
        object_name = 'RC:TxtMsg'
        content = {
            'content': 'hello',
            'mentionedInfo': {
                'type': 2,
                'userIdList': ['123', '456'],
                'mentionedContent': '有人@你'
            }
        }
        rep = rc.get_message().get_group().send_direction(from_user_id, to_group_id, to_user_ids, object_name, content)
        self.assertEqual(rep['code'], 200, rep)

{'fraction_non_alphanumeric': 0.15670698682072576, 'fraction_numerical': 0.025636396461455137, 'mean_word_length': 2.3273273273273274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3371574', 'n_tokens_mistral': 1982, 'n_tokens_neox': 1866, 'n_words': 338}