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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
Description: Switch to pytest from nose since the latter is now deprecated
Author: Mohammed Bilal <mdbilal@disroot.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018506
Forwarded: https://github.com/openvax/gtfparse/issues/29
Last-Update: 2022-12-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/test/test_expand_attributes.py
+++ b/test/test_expand_attributes.py
@@ -1,5 +1,4 @@
from gtfparse import expand_attribute_strings
-from nose.tools import eq_
def test_attributes_in_quotes():
attributes = [
@@ -7,10 +6,10 @@
"gene_id \"ENSG002\"; tag \"wolfpuppy\"; version \"2\";"
]
parsed_dict = expand_attribute_strings(attributes)
- eq_(list(sorted(parsed_dict.keys())), ["gene_id", "tag", "version"])
- eq_(parsed_dict["gene_id"], ["ENSG001", "ENSG002"])
- eq_(parsed_dict["tag"], ["bogotron", "wolfpuppy"])
- eq_(parsed_dict["version"], ["1", "2"])
+ assert list(sorted(parsed_dict.keys())) == ["gene_id", "tag", "version"]
+ assert parsed_dict["gene_id"] == ["ENSG001", "ENSG002"]
+ assert parsed_dict["tag"] == ["bogotron", "wolfpuppy"]
+ assert parsed_dict["version"] == ["1", "2"]
def test_attributes_without_quotes():
@@ -19,10 +18,10 @@
"gene_id ENSG002; tag wolfpuppy; version 2"
]
parsed_dict = expand_attribute_strings(attributes)
- eq_(list(sorted(parsed_dict.keys())), ["gene_id", "tag", "version"])
- eq_(parsed_dict["gene_id"], ["ENSG001", "ENSG002"])
- eq_(parsed_dict["tag"], ["bogotron", "wolfpuppy"])
- eq_(parsed_dict["version"], ["1", "2"])
+ assert list(sorted(parsed_dict.keys())) == ["gene_id", "tag", "version"]
+ assert parsed_dict["gene_id"] == ["ENSG001", "ENSG002"]
+ assert parsed_dict["tag"] == ["bogotron", "wolfpuppy"]
+ assert parsed_dict["version"] == ["1", "2"]
def test_optional_attributes():
@@ -32,6 +31,6 @@
"gene_id ENSG003; sometimes-present wolfpuppy;",
]
parsed_dict = expand_attribute_strings(attributes)
- eq_(list(sorted(parsed_dict.keys())), ["gene_id", "sometimes-present"])
- eq_(parsed_dict["gene_id"], ["ENSG001", "ENSG002", "ENSG003"])
- eq_(parsed_dict["sometimes-present"], ["bogotron", "", "wolfpuppy"])
+ assert list(sorted(parsed_dict.keys())) == ["gene_id", "sometimes-present"]
+ assert parsed_dict["gene_id"] == ["ENSG001", "ENSG002", "ENSG003"]
+ assert parsed_dict["sometimes-present"] == ["bogotron", "", "wolfpuppy"]
--- a/test/test_multiple_values_for_tag_attribute.py
+++ b/test/test_multiple_values_for_tag_attribute.py
@@ -1,6 +1,5 @@
from six import StringIO
from gtfparse import parse_gtf_and_expand_attributes
-from nose.tools import eq_
# failing example from https://github.com/openvax/gtfparse/issues/2
GTF_TEXT = (
@@ -15,18 +14,18 @@
def test_parse_tag_attributes():
parsed = parse_gtf_and_expand_attributes(StringIO(GTF_TEXT))
tag_column = parsed["tag"]
- eq_(len(tag_column), 1)
+ assert len(tag_column) == 1
tags = tag_column[0]
- eq_(tags, 'cds_end_NF,mRNA_end_NF')
+ assert tags == 'cds_end_NF,mRNA_end_NF'
def test_parse_tag_attributes_with_usecols():
parsed = parse_gtf_and_expand_attributes(
StringIO(GTF_TEXT),
restrict_attribute_columns=["tag"])
tag_column = parsed["tag"]
- eq_(len(tag_column), 1)
+ assert len(tag_column) == 1
tags = tag_column[0]
- eq_(tags, 'cds_end_NF,mRNA_end_NF')
+ assert tags == 'cds_end_NF,mRNA_end_NF'
def test_parse_tag_attributes_with_usecols_other_column():
parsed = parse_gtf_and_expand_attributes(
--- a/test/test_parse_gtf_lines.py
+++ b/test/test_parse_gtf_lines.py
@@ -1,5 +1,4 @@
import numpy as np
-from nose.tools import eq_, assert_raises
from gtfparse import (
parse_gtf,
parse_gtf_and_expand_attributes,
@@ -7,6 +6,7 @@
ParsingError
)
from six import StringIO
+from pytest import raises as assert_raises
gtf_text = """
# sample GTF data copied from:
@@ -28,27 +28,27 @@
"transcript_source",
]
# convert to list since Py3's dictionary keys are a distinct collection type
- eq_(list(parsed_dict.keys()), expected_columns)
- eq_(list(parsed_dict["seqname"]), ["1", "1"])
+ assert list(parsed_dict.keys()) == expected_columns
+ assert list(parsed_dict["seqname"]) == ["1", "1"]
# convert to list for comparison since numerical columns may be NumPy arrays
- eq_(list(parsed_dict["start"]), [11869, 11869])
- eq_(list(parsed_dict["end"]), [14409, 14409])
+ assert list(parsed_dict["start"]) == [11869, 11869]
+ assert list(parsed_dict["end"]) == [14409, 14409]
# can't compare NaN with equality
scores = list(parsed_dict["score"])
assert np.isnan(scores).all(), "Unexpected scores: %s" % scores
- eq_(list(parsed_dict["gene_id"]), ["ENSG00000223972", "ENSG00000223972"])
- eq_(list(parsed_dict["transcript_id"]), ["", "ENST00000456328"])
+ assert list(parsed_dict["gene_id"]) == ["ENSG00000223972", "ENSG00000223972"]
+ assert list(parsed_dict["transcript_id"]) == ["", "ENST00000456328"]
def test_parse_gtf_lines_without_expand_attributes():
parsed_dict = parse_gtf(StringIO(gtf_text))
# convert to list since Py3's dictionary keys are a distinct collection type
- eq_(list(parsed_dict.keys()), REQUIRED_COLUMNS)
- eq_(list(parsed_dict["seqname"]), ["1", "1"])
+ assert list(parsed_dict.keys()) == REQUIRED_COLUMNS
+ assert list(parsed_dict["seqname"]) == ["1", "1"]
# convert to list for comparison since numerical columns may be NumPy arrays
- eq_(list(parsed_dict["start"]), [11869, 11869])
- eq_(list(parsed_dict["end"]), [14409, 14409])
+ assert list(parsed_dict["start"]) == [11869, 11869]
+ assert list(parsed_dict["end"]) == [14409, 14409]
# can't compare NaN with equality
scores = list(parsed_dict["score"])
assert np.isnan(scores).all(), "Unexpected scores: %s" % scores
|