|
1 |
| -import pathlib |
2 |
| -import shutil |
3 |
| -import gzip |
4 |
| - |
5 | 1 | import numpy as np
|
6 | 2 | import pytest
|
7 | 3 | from numpy.testing import assert_array_equal
|
|
10 | 6 | from sc2ts import core
|
11 | 7 |
|
12 | 8 |
|
13 |
| -@pytest.fixture |
14 |
| -def data_cache(): |
15 |
| - cache_path = pathlib.Path("tests/data/cache") |
16 |
| - if not cache_path.exists(): |
17 |
| - cache_path.mkdir() |
18 |
| - return cache_path |
19 |
| - |
20 |
| - |
21 |
| -@pytest.fixture |
22 |
| -def alignments_fasta(data_cache): |
23 |
| - cache_path = data_cache / "alignments.fasta" |
24 |
| - if not cache_path.exists(): |
25 |
| - with gzip.open("tests/data/alignments.fasta.gz") as src: |
26 |
| - with open(cache_path, "wb") as dest: |
27 |
| - shutil.copyfileobj(src, dest) |
28 |
| - return cache_path |
29 |
| - |
30 |
| - |
31 |
| -@pytest.fixture |
32 |
| -def alignments_store(data_cache, alignments_fasta): |
33 |
| - cache_path = data_cache / "alignments.db" |
34 |
| - if not cache_path.exists(): |
35 |
| - with sa.AlignmentStore(cache_path, "a") as a: |
36 |
| - fasta = core.FastaReader(alignments_fasta) |
37 |
| - a.append(fasta, show_progress=False) |
38 |
| - return sa.AlignmentStore(cache_path) |
39 |
| - |
40 |
| - |
41 | 9 | class TestAlignmentsStore:
|
42 | 10 | def test_info(self, alignments_store):
|
43 | 11 | assert "contains" in str(alignments_store)
|
@@ -117,7 +85,7 @@ def test_lowercase_nucleotide_missing(self, hap):
|
117 | 85 | [0, -2],
|
118 | 86 | ],
|
119 | 87 | )
|
120 |
| - def test_examples(self, a): |
| 88 | + def test_error__examples(self, a): |
121 | 89 | with pytest.raises(ValueError):
|
122 | 90 | sa.decode_alignment(np.array(a))
|
123 | 91 |
|
|
0 commit comments