File: test_browser.py

package info (click to toggle)
pyquery 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: python: 2,768; makefile: 128; xml: 9; sh: 4
file content (17 lines) | stat: -rw-r--r-- 618 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import unittest

from pyquery.pyquery import PyQuery
from .browser_base import TextExtractionMixin


class TestInnerText(unittest.TestCase, TextExtractionMixin):
    def _prepare_dom(self, html):
        super(TestInnerText, self)._prepare_dom(html)
        self.pq = PyQuery(self.last_html)

    def _simple_test(self, html, expected_sq, expected_nosq, **kwargs):
        self._prepare_dom(html)
        text_sq = self.pq.text(squash_space=True, **kwargs)
        text_nosq = self.pq.text(squash_space=False, **kwargs)
        self.assertEqual(text_sq, expected_sq)
        self.assertEqual(text_nosq, expected_nosq)