[med-svn] [Git][med-team/filtlong][master] Fix patch for unittests

Pranav Ballaney gitlab at salsa.debian.org
Thu May 14 19:53:28 BST 2020



Pranav Ballaney pushed to branch master at Debian Med / filtlong


Commits:
ff0db5ec by Pranav Ballaney at 2020-05-14T22:55:17+05:30
Fix patch for unittests

- - - - -


1 changed file:

- debian/patches/ignore_locales_in_test_output.patch


Changes:

=====================================
debian/patches/ignore_locales_in_test_output.patch
=====================================
@@ -1,3 +1,12 @@
+Description: Ignore commas in numbers in test output
+	filtlong prints numbers with commas according to the locale
+	while unittests expect output in one particular format
+	This patch makes unittests ignore commas, so tests pass irrespective of locale.
+Author: Pranav Ballaney <ballaneypranav at gmail.com>
+Bug: https://github.com/rrwick/Filtlong/issues/15
+Last-Update: 2020-05-14 
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/test/test_sort.py
 +++ b/test/test_sort.py
 @@ -90,7 +90,7 @@ class TestSort(unittest.TestCase):
@@ -40,7 +49,7 @@
          output_reads = load_fasta(self.output_file)
          read_names = [x[0].decode() for x in output_reads]
          self.assertEqual(read_names, ['test_sort_1', 'test_sort_2', 'test_sort_3'])
--        self.assertTrue('target: 100000 bp' in console_out)
+-        self.assertTrue('target: 100,000 bp' in console_out)
 +        self.assertTrue('target: 100000 bp' in console_out.replace(',', ''))
          self.assertTrue('not enough reads to reach target' in console_out)
  
@@ -294,3 +303,118 @@
          self.assertTrue('target: 1 bp' in console_out)
 -        self.assertTrue('keeping 5,000 bp' in console_out)
 +        self.assertTrue('keeping 5000 bp' in console_out.replace(',', ''))
+--- a/test/test_split.py
++++ b/test/test_split.py
+@@ -76,7 +76,7 @@ class TestSplit(unittest.TestCase):
+         When splitting is off, the reads aren't split.
+         """
+         console_out = self.run_command('filtlong --min_length 1 -a ASSEMBLY INPUT > OUTPUT.fastq')
+-        self.assertTrue('4 reads (11,600 bp)' in console_out)
++        self.assertTrue('4 reads (11600 bp)' in console_out.replace(',', ''))
+         self.assertTrue('after splitting' not in console_out)
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 4)
+@@ -86,7 +86,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is over 200, no reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 250 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 4 reads (11,600 bp)' in console_out)
++        self.assertTrue('after splitting: 4 reads (11600 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 4)
+         for i in range(0, 4):
+@@ -97,7 +97,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is over 200, no reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 201 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 4 reads (11,600 bp)' in console_out)
++        self.assertTrue('after splitting: 4 reads (11600 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 4)
+         for i in range(0, 4):
+@@ -108,7 +108,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is exactly 200, only the last read is split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 200 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 5 reads (11,400 bp)' in console_out)
++        self.assertTrue('after splitting: 5 reads (11400 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 5)
+         for i in range(0, 3):
+@@ -121,7 +121,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is between 150 and 200, only the last read is split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 175 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 5 reads (11,400 bp)' in console_out)
++        self.assertTrue('after splitting: 5 reads (11400 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 5)
+         for i in range(0, 3):
+@@ -134,7 +134,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is between 50 and 100, tbe last two reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 75 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 6 reads (11,300 bp)' in console_out)
++        self.assertTrue('after splitting: 6 reads (11300 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 6)
+         for i in range(0, 2):
+@@ -149,7 +149,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is between 50 and 100, tbe last two reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 51 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 6 reads (11,300 bp)' in console_out)
++        self.assertTrue('after splitting: 6 reads (11300 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 6)
+         for i in range(0, 2):
+@@ -164,7 +164,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is exactly 50, tbe last three reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 50 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 7 reads (11,250 bp)' in console_out)
++        self.assertTrue('after splitting: 7 reads (11250 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 7)
+         self.check_one_read(split_reads[0], 2900, b'TCATTACG', b'AAAAGGAC')
+@@ -180,7 +180,7 @@ class TestSplit(unittest.TestCase):
+         When the split threshold is less than 50, tbe last three reads are split.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --split 25 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 7 reads (11,250 bp)' in console_out)
++        self.assertTrue('after splitting: 7 reads (11250 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 7)
+         self.check_one_read(split_reads[0], 2900, b'TCATTACG', b'AAAAGGAC')
+@@ -196,7 +196,7 @@ class TestSplit(unittest.TestCase):
+         Same as the previous test, but using reads as a reference.
+         """
+         console_out = self.run_command('filtlong -1 ILLUMINA_1 -2 ILLUMINA_2 --split 25 INPUT > OUTPUT.fastq')
+-        self.assertTrue('after splitting: 7 reads (11,250 bp)' in console_out)
++        self.assertTrue('after splitting: 7 reads (11250 bp)' in console_out.replace(',', ''))
+         split_reads = load_fastq(self.output_file)
+         self.assertEqual(len(split_reads), 7)
+         self.check_one_read(split_reads[0], 2900, b'TCATTACG', b'AAAAGGAC')
+--- a/test/test_trim.py
++++ b/test/test_trim.py
+@@ -76,16 +76,16 @@ class TestTrim(unittest.TestCase):
+         Tests read trimming console output using an assembly reference.
+         """
+         console_out = self.run_command('filtlong -a ASSEMBLY --trim INPUT > OUTPUT.fastq')
+-        self.assertTrue('4 reads (4,901 bp)' in console_out)
+-        self.assertTrue('after trimming: 4 reads (4,824 bp)' in console_out)
++        self.assertTrue('4 reads (4901 bp)' in console_out.replace(',', ''))
++        self.assertTrue('after trimming: 4 reads (4824 bp)' in console_out.replace(',', ''))
+ 
+     def test_trim_2(self):
+         """
+         Tests read trimming console output using Illumina read references.
+         """
+         console_out = self.run_command('filtlong -1 ILLUMINA_1 -2 ILLUMINA_2 --trim INPUT > OUTPUT.fastq')
+-        self.assertTrue('4 reads (4,901 bp)' in console_out)
+-        self.assertTrue('after trimming: 4 reads (4,824 bp)' in console_out)
++        self.assertTrue('4 reads (4901 bp)' in console_out.replace(',', ''))
++        self.assertTrue('after trimming: 4 reads (4824 bp)' in console_out.replace(',', ''))
+ 
+     def test_trim_3(self):
+         """



View it on GitLab: https://salsa.debian.org/med-team/filtlong/-/commit/ff0db5ecd8372e3ce40f691ebdabb69561199359

-- 
View it on GitLab: https://salsa.debian.org/med-team/filtlong/-/commit/ff0db5ecd8372e3ce40f691ebdabb69561199359
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200514/e3f0252f/attachment-0001.html>


More information about the debian-med-commit mailing list