File size: 775 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Test matches selectors."""
from .. import util


class TestMatches(util.TestCase):
    """Test matches selectors."""

    MARKUP = """
    <div>
    <p>Some text <span id="1"> in a paragraph</span>.
    <a id="2" href="http://google.com">Link</a>
    </p>
    </div>
    """

    def test_matches(self):
        """Test multiple selectors with "matches"."""

        self.assert_selector(
            self.MARKUP,
            ":matches(span, a)",
            ["1", "2"],
            flags=util.HTML
        )

    def test_nested_matches(self):
        """Test multiple nested selectors with "matches"."""

        self.assert_selector(
            self.MARKUP,
            ":matches(span, a:matches(#\\32))",
            ["1", "2"],
            flags=util.HTML
        )