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
