1 | import filecache |
---|
2 | import os |
---|
3 | import random |
---|
4 | import sys |
---|
5 | |
---|
6 | """ |
---|
7 | T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" |
---|
8 | |
---|
9 | def test(): |
---|
10 | s = os.stat( T ).st_size |
---|
11 | real_f = open( T ) |
---|
12 | f = filecache.FileCache( real_f, s ) |
---|
13 | for i in range( 1000 ): |
---|
14 | f.readline() |
---|
15 | |
---|
16 | def test_random_seeking(): |
---|
17 | s = os.stat( T ).st_size |
---|
18 | raw = open( T ) |
---|
19 | f = filecache.FileCache( open( T ), s ) |
---|
20 | for i in range( 10000 ): |
---|
21 | seek_to = random.randrange( s ) |
---|
22 | |
---|
23 | f.seek( seek_to ) |
---|
24 | raw.seek( seek_to ) |
---|
25 | |
---|
26 | l1 = f.readline() |
---|
27 | l2 = raw.readline() |
---|
28 | |
---|
29 | assert l1 == l2 |
---|
30 | """ |
---|