예제 #1
0
    def test_ignore_equal(self):
        p = AttributesParser('=', ignore=['chromosome', 'junk'])
        record = 'chromosome=1;ID=id0;junk=drawer'

        t = list(p.tokenize(record))
        self.assertEqual(t, [
            'chromosome', '=', '1', ';', 'ID', '=', 'id0', ';', 'junk', '=',
            'drawer'
        ])
        attributes = p(record)
        self.assertEqual(attributes, 1)
        self.assertIn('ID', p.terms)
        self.assertEqual(p.terms['ID'][0], 'id0')
        self.assertNotIn('chromosome', p.terms)
        self.assertEqual(p.reserved['chromosome'], 0)
예제 #2
0
 def test_gff_extra_semicolons(self):
     p = AttributesParser('=')
     t = list(p.tokenize(' a=1;; b="b"; '))
     self.assertEqual(t, ['a', '=', '1', ';', 'b', '=', '"b"', ';'])
예제 #3
0
 def test_gtf_extra_spaces(self):
     p = AttributesParser(' ')
     t = list(p.tokenize(' a 1;    b   "b"; '))
     self.assertEqual(t, ['a', ' ', '1', ';', 'b', ' ', '"b"', ';'])
예제 #4
0
 def test_embedded_sep(self):
     p = AttributesParser(' ')
     t = list(p.tokenize('a "b;c"; d 1'))
     self.assertEqual(t, ['a', ' ', '"b;c"', ';', 'd', ' ', '1'])
예제 #5
0
 def test_quoting_missing(self):
     p = AttributesParser(' ')
     self.assertRaises(ValueError, list, p.tokenize('a "b'))
예제 #6
0
 def test_gff_value_with_spaces(self):
     p = AttributesParser('=')
     t = list(p.tokenize('mol_type=genomic DNA'))
     self.assertEqual(t, ['mol_type', '=', 'genomic DNA'])