示例#1
0
 def test_default(self):
     filter_iter = seqfilter.length_filter(self.seqs)
     self.assertIsInstance(filter_iter, types.GeneratorType)
     filtrate = list(filter_iter)
     self.assertEqual(len(filtrate), len(self.seqs))
     self.assertEqual(self.seqs, filtrate)
示例#2
0
 def test_no_filtrate(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 9, 10))
     self.assertEqual([], filtrate)
     filtrate = list(seqfilter.length_filter(self.seqs, 0, 3))
     self.assertEqual([], filtrate)
示例#3
0
 def test_limit_error(self):
     f = seqfilter.length_filter([], 6, 5)
     self.assertRaises(ValueError, f.next)
示例#4
0
 def test_equal_min_max(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 6, 6))
     self.assertEqual(len(filtrate), 1)
     self.assertTrue(filtrate[0] is self.seqs[2])
示例#5
0
 def test_empty_iter(self):
     filtrate = list(seqfilter.length_filter([]))
     self.assertEqual([], filtrate)
示例#6
0
 def test_no_max(self):
     for i in range(4, 9):
         filtrate = list(seqfilter.length_filter(self.seqs, i))
         self.assertEqual(len(filtrate), 9-i)
示例#7
0
 def test_no_min(self):
     for i in range(4, 9):
         filtrate = list(seqfilter.length_filter(self.seqs, max_length=i))
         self.assertEqual(len(filtrate), i-3)
示例#8
0
 def test_no_filtrate(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 9, 10))
     self.assertEqual([], filtrate)
     filtrate = list(seqfilter.length_filter(self.seqs, 0, 3))
     self.assertEqual([], filtrate)
示例#9
0
 def test_no_filter_limit(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 4, 8))
     self.assertEqual(len(filtrate), len(self.seqs))
     self.assertEqual(self.seqs, filtrate)
示例#10
0
 def test_equal_min_max(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 6, 6))
     self.assertEqual(len(filtrate), 1)
     self.assertTrue(filtrate[0] is self.seqs[2])
示例#11
0
 def test_empty_iter(self):
     filtrate = list(seqfilter.length_filter([]))
     self.assertEqual([], filtrate)
示例#12
0
 def test_no_min(self):
     for i in range(4, 9):
         filtrate = list(seqfilter.length_filter(self.seqs, max_length=i))
         self.assertEqual(len(filtrate), i - 3)
示例#13
0
 def test_no_max(self):
     for i in range(4, 9):
         filtrate = list(seqfilter.length_filter(self.seqs, i))
         self.assertEqual(len(filtrate), 9 - i)
示例#14
0
 def test_no_filter_limit(self):
     filtrate = list(seqfilter.length_filter(self.seqs, 4, 8))
     self.assertEqual(len(filtrate), len(self.seqs))
     self.assertEqual(self.seqs, filtrate)
示例#15
0
 def test_default(self):
     filter_iter = seqfilter.length_filter(self.seqs)
     self.assertIsInstance(filter_iter, types.GeneratorType)
     filtrate = list(filter_iter)
     self.assertEqual(len(filtrate), len(self.seqs))
     self.assertEqual(self.seqs, filtrate)
示例#16
0
 def test_limit_error(self):
     f = seqfilter.length_filter([], 6, 5)
     self.assertRaises(ValueError, f.next)