]> git.scottworley.com Git - paperdoorknob/blame_incremental - domfilter_test.py
Move get_title() to Thread
[paperdoorknob] / domfilter_test.py
... / ...
CommitLineData
1# paperdoorknob: Print glowfic
2#
3# This program is free software: you can redistribute it and/or modify it
4# under the terms of the GNU General Public License as published by the
5# Free Software Foundation, version 3.
6
7
8import unittest
9
10from bs4 import BeautifulSoup
11
12from domfilter import ApplyDOMFilters
13
14
15class TestDOMFilters(unittest.TestCase):
16
17 def setUp(self) -> None:
18 self._strike = BeautifulSoup(b'''
19 <div class="post-content">
20 <p><span style="text-decoration: line-through;">Abandon hope and endure.</span></p>
21 <p>No. Win.</p>
22 </div>''', 'html.parser')
23
24 def testStrike(self) -> None:
25 ApplyDOMFilters('Strike', self._strike)
26 s = self._strike.find_all('s')
27 self.assertEqual(len(s), 1)
28 self.assertEqual(list(s[0].stripped_strings),
29 ['Abandon hope and endure.'])
30
31
32if __name__ == '__main__':
33 unittest.main()