File size: 531 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Test quirky behaviors."""
from . import util
from bs4 import BeautifulSoup


class TestQuirks(util.TestCase):
    """Test quirky behaviors."""

    def test_quirky_user_attrs(self):
        """Test cases where a user creates weird attributes: nested sequences."""

        html = """
        <div id="test">test</div>
        """

        soup = BeautifulSoup(html, 'html.parser')
        soup.div.attrs['user'] = [['a']]
        print(soup.div.attrs)
        self.assertTrue(soup.select_one('div[user="[\'a\']"]') is not None)