import pytest


@pytest.mark.parametrize(
    "input,output",
    [("AT5G54690.2", "AT5G54690"), ("evm.test.1", "evm.test.1")],
)
def test_gene_name(input, output):
    from jcvi.utils.cbook import gene_name

    assert gene_name(input) == output


@pytest.mark.parametrize(
    "seqid,sep,stdpf,output",
    [
        ("chr1_random", ["-"], False, ("chr", "1", "_random")),
        ("chr1_random", ["-"], True, ("C", "1", "_random")),
        ("AmTr_v1.0_scaffold00001", ["-"], False, ("AmTr_v1.0_scaffold", "00001", "")),
        ("AmTr_v1.0_scaffold00001", [], True, ("Sca", "00001", "")),
        ("PDK_30s1055861", [], True, ("C", "1055861", "")),
        ("PDK_30s1055861", ["-"], False, ("PDK_30s", "1055861", "")),
        ("AC235758.1", ["-"], False, ("AC", "235758.1", "")),
    ],
)
def test_seqid_parse(seqid, sep, stdpf, output):
    from jcvi.utils.cbook import seqid_parse

    assert seqid_parse(seqid, sep, stdpf) == output

@@ -1,12 +1,33 @@
+import os.path as op%0A
 import pytes
@@ -943,20 +943,381 @@
 p, stdpf) == output%0A
+%0A%0Adef test_depends():%0A    from jcvi.apps.base import cleanup%0A    from jcvi.utils.cbook import depends%0A%0A    @depends%0A    def func1(infile=%22a%22, outfile=%22b%22):%0A        assert op.exists(infile)%0A        with open(outfile, %22w%22):%0A            pass%0A%0A    with open(%22a%22, %22w%22):%0A        pass%0A    func1(infile=%22a%22, outfile=%22b%22)%0A    assert op.exists(%22b%22)%0A    cleanup(%22a%22, %22b%22)%0A

Add test to depends()