def test_connection_grouping_queryset(self):
        self.create_lang_connection('1000000000', 'en')
        self.create_lang_connection('1000000001', 'en')
        self.create_lang_connection('1000000002', 'en')
        self.create_lang_connection('1000000003', 'es')
        self.create_lang_connection('1000000004', 'es')
        self.create_lang_connection('1000000005', 'fr')
        connections = Connection.objects.all()
        grouped_conns = list(trans_helpers.group_connections(connections))
        for lang, conns in grouped_conns:
            if lang == 'en':
                self.assertEqual(3, len(conns))
            elif lang == 'es':
                self.assertEqual(2, len(conns))
            elif lang == 'fr':
                self.assertEqual(1, len(conns))
Same test as above but with a QuerySet object.
dataset/ETHPy150Open rapidsms/rapidsms/rapidsms/tests/translation/tests.py/TranslationHelperTest.test_connection_grouping_queryset