File: test_zran.py

package info (click to toggle)
indexed-gzip 1.8.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: ansic: 1,916; python: 1,648; makefile: 13; sh: 12
file content (145 lines) | stat: -rw-r--r-- 4,532 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env python
#
# test_zran.py - Python wrapper around ctest_zran.pyx.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#

from __future__ import print_function

import warnings

import sys

try:
    from . import ctest_zran
except ImportError:
    warnings.warn(UserWarning('indexed_gzip.ctest_zran not '
                              'found - cannot run zran tests'))
    ctest_zran = None

if (ctest_zran is not None) and (not sys.platform.startswith("win")):
    # Run these tests only on POSIX systems
    import pytest

    import numpy as np

    pytestmark = pytest.mark.zran_test

    def test_fread():
        ctest_zran.test_fread()

    def test_ftell():
        ctest_zran.test_ftell()

    def test_fseek():
        ctest_zran.test_fseek()

    def test_feof():
        ctest_zran.test_feof()

    def test_ferror():
        ctest_zran.test_ferror()

    def test_fflush():
        ctest_zran.test_fflush()

    def test_fwrite():
        ctest_zran.test_fwrite()

    def test_getc():
        ctest_zran.test_getc()

    def test_seekable():
        ctest_zran.test_seekable()

    def test_init(testfile):
        for no_fds in (True, False):
            ctest_zran.test_init(testfile, no_fds)

    def test_init_file_modes(testfile):
        for no_fds in (True, False):
            ctest_zran.test_init_file_modes(testfile, no_fds)

    def test_no_auto_build(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_no_auto_build(testfile, no_fds, nelems)

    def test_seek_to_end(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_seek_to_end(testfile, no_fds, nelems)

    def test_seek_cur(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_seek_cur(testfile, no_fds, nelems)

    def test_seek_end(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_seek_end(testfile, no_fds, nelems)

    def test_seek_beyond_end(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_seek_beyond_end(testfile, no_fds, nelems)

    def test_sequential_seek_to_end(testfile, nelems, niters):
        for no_fds in (True, False):
            ctest_zran.test_sequential_seek_to_end(testfile, no_fds, nelems, niters)

    def test_random_seek(testfile, nelems, niters, seed):
        for no_fds in (True, False):
            ctest_zran.test_random_seek(testfile, no_fds, nelems, niters, seed)

    def test_read_all(testfile, nelems, use_mmap):
        for no_fds in (True, False):
            ctest_zran.test_read_all(testfile, no_fds, nelems, use_mmap)

    @pytest.mark.slow_test
    def test_seek_then_read_block(testfile, nelems, niters, seed, use_mmap):
        for no_fds in (True, False):
            ctest_zran.test_seek_then_read_block(
                testfile, no_fds, nelems, niters, seed, use_mmap
            )

    def test_random_seek_and_read(testfile, nelems, niters, seed):
        for no_fds in (True, False):
            ctest_zran.test_random_seek_and_read(testfile, no_fds, nelems, niters, seed)

    @pytest.mark.slow_test
    def test_read_all_sequential(testfile, nelems):
        for no_fds in (True, False):
            ctest_zran.test_read_all_sequential(testfile, no_fds, nelems)

    @pytest.mark.slow_test
    def test_build_then_read(testfile, nelems, seed, use_mmap):
        for no_fds in (True, False):
            ctest_zran.test_build_then_read(testfile, no_fds, nelems, seed, use_mmap)

    @pytest.mark.slow_test
    def test_readbuf_spacing_sizes(testfile, nelems, niters, seed):
        for no_fds in (True, False):
            ctest_zran.test_readbuf_spacing_sizes(
                testfile, no_fds, nelems, niters, seed
            )

    def test_export_then_import(testfile):
        for no_fds in (True, False):
            ctest_zran.test_export_then_import(testfile, no_fds)

    def test_export_import_no_points():
        for no_fds in (True, False):
            ctest_zran.test_export_import_no_points(no_fds)

    def test_export_import_format_v0():
        ctest_zran.test_export_import_format_v0()

    def test_crc_validation(concat):
        ctest_zran.test_crc_validation(concat)

    def test_standard_usage_with_null_padding(concat):
        ctest_zran.test_standard_usage_with_null_padding(concat)

    def test_inflateInit_leak_on_error():
        ctest_zran.test_inflateInit_leak_on_error()

    def test_read_eof_memmove_rotate_bug(seed):
        ctest_zran.test_read_eof_memmove_rotate_bug(seed)