]> git.scottworley.com Git - paperdoorknob/blob - domfilter_test.py
Handle Unicode characters ≈ and ◁
[paperdoorknob] / domfilter_test.py
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
8 import unittest
9
10 from bs4 import BeautifulSoup
11
12 from domfilter import ApplyDOMFilters
13
14
15 class 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
32 if __name__ == '__main__':
33 unittest.main()