File: test_pathlib.py

package info (click to toggle)
python-pybedtools 0.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,620 kB
  • sloc: python: 10,030; cpp: 899; makefile: 142; sh: 57
file content (27 lines) | stat: -rw-r--r-- 721 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
import os
import pathlib

import pybedtools
import pytest


def test_pathlib_base():
    file = "a.bed"
    fn = os.path.join(pybedtools.filenames.data_dir(), file)
    path = pathlib.PurePath(fn)
    assert pybedtools.BedTool(path).fn == fn


def test_pathlib_derived():
    file = "a.bed"
    fn = os.path.join(pybedtools.filenames.data_dir(), file)
    path = pathlib.Path(fn)
    assert pybedtools.BedTool(path).fn == fn


# this may be unnecessary, as the check is performed after str conversion
def test_pathlib_nonexistent_file():
    fn = os.path.join(pybedtools.filenames.data_dir(), "this_file_is_missing")
    path = pathlib.Path(fn)
    with pytest.raises(FileNotFoundError):
        pybedtools.BedTool(path)