File: filecache_tests.py

package info (click to toggle)
python-bx 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,000 kB
  • sloc: python: 17,136; ansic: 2,326; makefile: 24; sh: 8
file content (25 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
T="/Users/james/cache/hg18/align/multiz28way/chr10.maf"

def test():
    s = os.stat( T ).st_size
    real_f = open( T )
    f = filecache.FileCache( real_f, s )
    for i in range( 1000 ):
        f.readline()

def test_random_seeking():
    s = os.stat( T ).st_size
    raw = open( T )
    f = filecache.FileCache( open( T ), s )
    for i in range( 10000 ):
        seek_to = random.randrange( s )

        f.seek( seek_to )
        raw.seek( seek_to )

        l1 = f.readline()
        l2 = raw.readline()

        assert l1 == l2
"""