コード例 #1
0
ファイル: tests.py プロジェクト: markdwhite/friendlydb
    def test_clear(self):
        fdb = FriendlyDB(data_directory=self.data_dir)
        daniel = fdb['daniel']

        self.assertFalse(os.path.exists(daniel.full_path))
        daniel.setup()
        self.assertTrue(os.path.exists(daniel.full_path))

        self.assertTrue(fdb.clear())
        self.assertFalse(os.path.exists(daniel.full_path))
コード例 #2
0
ファイル: tests.py プロジェクト: AltisCorp/friendlydb
    def test_clear(self):
        fdb = FriendlyDB(host=self.host, port=self.port, db=self.db)
        daniel = fdb['daniel']
        daniel_key = daniel.generate_key(daniel.username, 'following')

        self.assertFalse(self.conn.zrange(daniel_key, 0, -1))
        daniel.follow('alice')
        self.assertTrue(self.conn.zrange(daniel_key, 0, -1))

        self.assertTrue(fdb.clear())
        self.assertFalse(self.conn.zrange(daniel_key, 0, -1))
コード例 #3
0
ファイル: tests.py プロジェクト: toastdriven/friendlydb
    def test_clear(self):
        fdb = FriendlyDB(host=self.host, port=self.port, db=self.db)
        daniel = fdb['daniel']
        daniel_key = daniel.generate_key(daniel.username, 'following')

        self.assertFalse(self.conn.zrange(daniel_key, 0, -1))
        daniel.follow('alice')
        self.assertTrue(self.conn.zrange(daniel_key, 0, -1))

        self.assertTrue(fdb.clear())
        self.assertFalse(self.conn.zrange(daniel_key, 0, -1))
コード例 #4
0
ファイル: benchmark.py プロジェクト: toastdriven/friendlydb
        end = time.time()
        times.append(end - start)

    overall_end = time.time()
    results['overall_time'] = overall_end - overall_start

    # Calculate mean/min/max.
    results['mean_time'] = sum(times) / len(times)
    results['min_time'] = min(times)
    results['max_time'] = max(times)
    return results


if __name__ == '__main__':
    fdb.clear()

    print('Running benchmark...')
    print('  User Count: %s' % user_count)
    print('  Relation Count: %s' % relation_count)
    print('  Followers Check Count: %s' % followers_check)

    print('')
    print('')
    print('')
    print('Generating users...')
    print("Generating %s took %s" % (user_count, time_taken(generate_users)))
    print('')
    print('Building relations...')
    print("Building %s relations took %s" % (relation_count, time_taken(build_relations)))
    print('')