]>
git.scottworley.com Git - paperdoorknob/blob - domfilter_test.py
1 # paperdoorknob: Print glowfic
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.
10 from bs4
import BeautifulSoup
12 from domfilter
import ApplyDOMFilters
15 class TestDOMFilters(unittest
.TestCase
):
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>
22 </div>''', 'html.parser')
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.'])
32 if __name__
== '__main__':