File: test_load.py

package info (click to toggle)
mdtraj 1.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,324 kB
  • sloc: python: 25,216; ansic: 6,266; cpp: 5,685; xml: 1,252; makefile: 192
file content (31 lines) | stat: -rw-r--r-- 969 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
26
27
28
29
30
31
from mdtraj import load
from mdtraj.testing import eq


def test_load_single(get_fn):
    # Just check for any raised errors coming from loading a single file.
    load(get_fn("frame0.pdb"))


def test_load_single_top_none(get_fn):
    # Just check for any raised errors coming from loading a single file with top=None
    load(get_fn("frame0.pdb"), top=None)


def test_load_single_list(get_fn):
    # See if a single-element list of files is successfully loaded.
    load([get_fn("frame0.pdb")])


def test_load_many_list(get_fn):
    # See if a multi-element list of files is successfully loaded.
    single = load(get_fn("frame0.pdb"))
    double = load(2 * [get_fn("frame0.pdb")], discard_overlapping_frames=False)
    assert 2 * single.n_frames == double.n_frames


def test_load_atom_indices_multiple_files(get_fn):
    ref_t = load(get_fn("native.pdb"))
    t = load([get_fn("native.pdb")] * 2, atom_indices=[0])

    eq(t.topology, ref_t.topology.subset([0]))