dputhier / libgtftk

gtftk C Library and program
GNU General Public License v3.0
3 stars 2 forks source link

del_attr test no more working and passing tests #94

Closed dputhier closed 5 years ago

dputhier commented 5 years ago

In the previous version of pygtftk, this test on del_attr used to pass:

    >>> from  pygtftk.utils import get_example_file
    >>> from pygtftk.gtf_interface import GTF
    >>> from pygtftk.utils import TAB
    >>> a_file = get_example_file()[0]
    >>> a_gtf = GTF(a_file)
    >>> # The force arg indicate not to raise an error when deleting gene_id/tx_id keys.
    >>> assert a_gtf.del_attr(keys="gene_id,exon_id,ccds_id", force=True).get_attr_list() == ['transcript_id']

But it seems it is no more functional. Consider:

    >>> from  pygtftk.utils import get_example_file
    >>> from pygtftk.gtf_interface import GTF
    >>> a_file = get_example_file()[0]
    >>> a_gtf = GTF(a_file)
    >>> assert sum(a_gtf.is_defined("transcript_id")) == 60
    >>> gn_val = ('.', '.', '.', '.', 1, 2, 3, 4, '?', '?')
    >>> gn_ids = tuple(a_gtf.get_gn_ids(nr=True))
    >>> b_gtf = a_gtf.add_attr_from_list(feat="gene", key="gene_id", key_value=(gn_ids), new_key="foo", new_key_value=gn_val)
    >>> print(b_gtf)
    >>> print(b_gtf.del_attr(keys='foo'))
fafa13 commented 5 years ago

I've just pushed a fix for this bug. I cannot test it because it seems that some python3 module (future) is missing in blackflag ... Let me know if that's better.

dputhier commented 5 years ago

ab19e8d50fb45a9b07217787bea463aafe23db08 did the trick. Closing