Пример #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'])