|
4 | 4 |
|
5 | 5 | @pytest.mark.benchmark(group="linear_contains") |
6 | 6 | @pytest.mark.parametrize("gene, key_codon, expected", [ |
7 | | - ("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT", (Nucleotide.A, Nucleotide.C, Nucleotide.G), True), |
8 | | - ("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT", (Nucleotide.G, Nucleotide.A, Nucleotide.T), False), |
| 7 | + (string_to_gene("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT"), |
| 8 | + (Nucleotide.A, Nucleotide.C, Nucleotide.G), |
| 9 | + True), |
| 10 | + (string_to_gene("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT"), |
| 11 | + (Nucleotide.G, Nucleotide.A, Nucleotide.T), |
| 12 | + False), |
9 | 13 | ], ids=["successful", "failed"]) |
10 | | -def test_linear_contains(benchmark, gene_str, key_codon, expected): |
11 | | - gene = string_to_gene(gene_str) |
| 14 | +def test_linear_contains(benchmark, gene, key_codon, expected): |
12 | 15 | result = benchmark(linear_contains, gene, key_codon) |
13 | 16 | assert expected == result |
14 | 17 |
|
15 | 18 |
|
16 | 19 | @pytest.mark.benchmark(group="binary_contains") |
17 | 20 | @pytest.mark.parametrize("gene, key_codon, expected", [ |
18 | | - ("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT", (Nucleotide.A, Nucleotide.C, Nucleotide.G), True), |
19 | | - ("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT", (Nucleotide.G, Nucleotide.A, Nucleotide.T), False), |
| 21 | + (sorted(string_to_gene("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT")), |
| 22 | + (Nucleotide.A, Nucleotide.C, Nucleotide.G), |
| 23 | + True), |
| 24 | + (sorted(string_to_gene("ACGTGGCTCTCTAACGTACGTACGTACGGGGTTTATATATACCCTAGGACTCCCTTT")), |
| 25 | + (Nucleotide.G, Nucleotide.A, Nucleotide.T), |
| 26 | + False), |
20 | 27 | ], ids=["successful", "failed"]) |
21 | | -def test_binary_contains(benchmark, gene_str, key_codon, expected): |
22 | | - sorted_gene = sorted(string_to_gene(gene_str)) |
23 | | - result = benchmark(binary_contains, sorted_gene, key_codon) |
| 28 | +def test_binary_contains(benchmark, gene, key_codon, expected): |
| 29 | + result = benchmark(binary_contains, gene, key_codon) |
24 | 30 | assert expected == result |
0 commit comments