File: test_pbcore_io_FofnIO.py

package info (click to toggle)
python-pbcore 1.2.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,612 kB
  • ctags: 5,336
  • sloc: python: 22,160; xml: 2,667; makefile: 239
file content (22 lines) | stat: -rw-r--r-- 642 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
from nose.tools import assert_equal, assert_true, assert_false
from numpy.testing import assert_array_equal
from StringIO import StringIO
from os.path import isabs

from pbcore import data
from pbcore.io import readFofn

def test_simple():
    fofn = StringIO("/a/b\n/c/d")
    lst = list(readFofn(fofn))
    assert_array_equal(["/a/b", "/c/d"], lst)

def test_empty_lines():
    fofn = StringIO("/a/b\n \n/c/d\n ")
    lst = list(readFofn(fofn))
    assert_array_equal(["/a/b", "/c/d"], lst)

def test_absolutifying():
    for fofnPath in data.getFofns():
        for filePath in readFofn(fofnPath):
            assert_true(isabs(filePath))