def test_load(self):
        user1 = make_user('user1', 'user1', True)
        user2 = make_user('user2', 'user2', False)
        user3 = make_user('user3', 'user3', False)
        user3.admin = True
        self.db.add_all([user1, user2, user3])
        transaction.commit()
        self.access.set_allow_register(False)
        self.access.create_group('g1')
        self.access.create_group('g2')
        self.access.edit_user_group('user2', 'g1', True)
        self.access.edit_user_group('user2', 'g2', True)
        self.access.edit_user_group('user3', 'g2', True)
        self.access.edit_user_permission('pkg1', 'user2', 'read', True)
        self.access.edit_user_permission('pkg2', 'user3', 'read', True)
        self.access.edit_user_permission('pkg2', 'user3', 'write', True)
        self.access.edit_group_permission('pkg1', 'g1', 'read', True)
        self.access.edit_group_permission('pkg2', 'g2', 'read', True)
        self.access.edit_group_permission('pkg2', 'g2', 'write', True)

        data1 = self.access.dump()

        SQLAccessBackend.configure(self.settings)
        kwargs = SQLAccessBackend.configure(self.settings)
        access2 = SQLAccessBackend(MagicMock(), **kwargs)
        access2.load(data1)
        data2 = access2.dump()

        def assert_nice_equals(obj1, obj2):
            """ Assertion that handles unordered lists inside dicts """
            if isinstance(obj1, dict):
                self.assertEqual(len(obj1), len(obj2))
                for key, val in obj1.iteritems():
                    assert_nice_equals(val, obj2[key])
            elif isinstance(obj1, list):
                self.assertItemsEqual(obj1, obj2)
            else:
                self.assertEqual(obj1, obj2)

        assert_nice_equals(data2, data1)

        # Load operation should be idempotent
        access2.load(data2)
        data3 = access2.dump()
        assert_nice_equals(data3, data2)
Prints statistic information using io stream.
dataset/ETHPy150Open mathcamp/pypicloud/tests/test_access_backends.py/TestSQLBackend.test_load--crossover with--dataset/ETHPy150Open xtrementl/focus/focus/plugin/modules/stats.py/Stats._print_stats