File size: 812 Bytes
23a728e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright 2026 Emile de Bruyn
# SPDX-License-Identifier: Apache-2.0

import pytest

from motifbench_prosite.prosite_patterns import classify_prosite, prosite_span


@pytest.mark.parametrize(
    "pattern, expected",
    [
        ("C-x(2)-C-x(4)-H-x(4)-C.", (14, 14)),
        ("A-x(2,4)-B", (4, 6)),
        ("<[ST]-x-{P}>", (3, 3)),
        ("G(2)-x(0,1)-[ST]", (3, 4)),
    ],
)
def test_prosite_span_known_lengths(pattern, expected):
    assert prosite_span(pattern) == expected


def test_classify_prosite_flags_variable_pattern():
    info = classify_prosite("A-x(2,4)-B")
    assert info["min_span"] == 4
    assert info["max_span"] == 6
    assert info["fixed_length"] is False
    assert info["variable_length"] is True
    assert info["contiguous"] is True
    assert info["non_contiguous"] is False