File: test_pbcore_io_FofnIO.py

package info (click to toggle)
python-pbcore 1.6.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,168 kB
  • sloc: python: 25,497; xml: 2,846; makefile: 251; sh: 24
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))