File: file_io_indexed_gzip_test.py

package info (click to toggle)
python-pymzml 2.5.2%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 27,792 kB
  • sloc: python: 6,495; pascal: 341; makefile: 233; sh: 30
file content (51 lines) | stat: -rwxr-xr-x 1,070 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Part of pymzml test cases
"""
import os
from pymzml.file_classes.indexedGzip import IndexedGzip
import unittest
import random
from pymzml.spec import Spectrum, Chromatogram
import struct
import re
import test_file_paths


class IndexedGzipTest(unittest.TestCase):
    """
    """

    def setUp(self):
        paths = test_file_paths.paths
        self.File = IndexedGzip(paths[2], "latin-1")

    def tearDown(self):
        """
        """
        self.File.close()

    def test_build_index(self):
        """
        """
        # more elaborated?
        self.assertIsNotNone(self.File.offset_dict)

    def test_getitem_5(self):
        """
        """
        ID = 5
        spec = self.File[ID]
        self.assertIsInstance(spec, Spectrum)
        self.assertEqual(spec.ID, ID)

    def test_getitem_tic(self):
        ID = "TIC"
        chrom = self.File[ID]
        self.assertIsInstance(chrom, Chromatogram)
        self.assertEqual(chrom.ID, ID)


if __name__ == "__main__":
    unittest.main(verbosity=3)