Skip to content

Commit

Permalink
Remove new module test due to Travis-CI lib path
Browse files Browse the repository at this point in the history
  • Loading branch information
dvklopfenstein committed Jul 10, 2018
1 parent b4e6ee5 commit 7e2a334
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/test_wr_sections_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ def test_wr_sections_all():
"""Test that all sections files generated by wr_sections have the same content."""
f_sec_rd = "data/gjoneska_pfenning/sections_in.txt"
f_sec_wr = "tmp_test_sections_out.txt"
f_sec_py = "goatools/test_data/sections/tmp_test_sections.py"
f_sec_mod = "goatools.test_data.sections.tmp_test_sections"
# Travis-CI path is cwd
f_sec_py = "tmp_test_sections.py"
# f_sec_mod = "tmp_test_sections"
# Read user GO IDs. Setup to write sections text file and Python file
usrgos = [getattr(nt, 'GO') for nt in goea_results]
sec_rd = _read_sections(f_sec_rd)
# Do preliminaries
godag = get_godag("go-basic.obo", prt=None, loading_bar=False, optional_attrs=['relationship'])
gosubdag = GoSubDag(usrgos, godag, relationships=True, tcntobj=None)
grprdflt = GrouperDflts(gosubdag)
hdrobj = HdrgosSections(gosubdag, grprdflt.hdrgos_dflt, sec_rd)
# Exclude ungrouped "Misc." section of sections var(sec_rd)
hdrobj = HdrgosSections(gosubdag, grprdflt.hdrgos_dflt, sec_rd[:-1])
assert sec_rd[-1][0] == hdrobj.secdflt, sec_rd[-1][0]
grprobj = Grouper("test", usrgos, hdrobj, gosubdag)
# Create text and Python sections files
objsecwr = WrSectionsTxt(grprobj)
Expand All @@ -39,8 +42,9 @@ def test_wr_sections_all():
# Read text and Python sections files
sec_wr = _read_sections(f_sec_wr)
sec_py = _read_sections(f_sec_py)
sec_mod = _read_sections(f_sec_mod)
_chk_sections(sec_py, sec_mod)
# sec_mod = _read_sections(f_sec_mod)
# _chk_sections(sec_py, sec_mod)
# _chk_sections(sec_wr, sec_mod, hdrobj.secdflt)

def test_wr_sections_txt():
"""Group depth-02 GO terms under their most specific depth-01 GO parent(s)."""
Expand Down Expand Up @@ -70,8 +74,13 @@ def test_wr_sections_txt():
_chk_sections(sec2a, sec2b)


def _chk_sections(sec_a, sec_b):
def _chk_sections(sec_a, sec_b, hdrgos_dflt=None):
"""Do the two sections variables contain the same data?"""
if hdrgos_dflt:
assert sec_a[-1][0] == hdrgos_dflt, "EXP({}) ACT({})".format(hdrgos_dflt, sec_a[-1][0])
sec_a = sec_a[:-1]
print("EXP({}) ACT({})".format(hdrgos_dflt, sec_b[-1][0]))
# sec_b = sec_b[:-1]
assert len(sec_a) == len(sec_b), "LENGTH MISMATCH: {A} != {B}".format(
A=len(sec_a), B=len(sec_b))
for (name_a, gos_a), (name_b, gos_b) in zip(sec_a, sec_b):
Expand Down

0 comments on commit 7e2a334

Please sign in to comment.