File: pickle_test.py

package info (click to toggle)
python-intervaltree-bio 1.0.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 18,036 kB
  • sloc: python: 307; makefile: 8; sh: 5
file content (22 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'''
Test module for GenomeIntervalTree

Copyright 2014, Konstantin Tretyakov

Licensed under MIT license.
'''
import os

from intervaltree_bio import GenomeIntervalTree
from collections import defaultdict
import pickle

def test_pickling():
    git = GenomeIntervalTree()
    git['a'][1:2] = ['some', 'data']
    git['a'][1.5:2.5] = ['more', 'data']
    git['b'][10:12] = ['even', 'more', 'data']
    s = pickle.dumps(git)
    new_git = pickle.loads(s)
    assert len(git) == len(new_git)
    assert len(git['a']) == len(new_git['a'])