diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/beautifulsoup/README.txt (renamed from src/beautifulsoup/README) | 28 | ||||
-rw-r--r-- | src/beautifulsoup/tests/test_soup.py | 12 |
2 files changed, 35 insertions, 5 deletions
diff --git a/src/beautifulsoup/README b/src/beautifulsoup/README.txt index 8feac71..d011072 100644 --- a/src/beautifulsoup/README +++ b/src/beautifulsoup/README.txt @@ -1,7 +1,33 @@ +Introduction +============ + + >>> from beautifulsoup import BeautifulSoup + >>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML") + >>> print soup.prettify() + <p> + Some + <b> + bad + <i> + HTML + </i> + </b> + </p> + + >>> soup.find(text="bad") + u'bad' + + >>> soup.i + <i>HTML</i> + + +Python 3 +======== + The canonical version of Beautiful Soup is the Python 2 version. You can generate the Python 3 version by running to3.sh, or by doing what to3.sh does: run 2to3 on BeautifulSoup.py and BeautifulSoupTests.py, then applying the appropriate .3.diff file to each generated script. The testall.sh script tests both the Python 2 version and a freshly -generated Python 3 version.
\ No newline at end of file +generated Python 3 version. diff --git a/src/beautifulsoup/tests/test_soup.py b/src/beautifulsoup/tests/test_soup.py index e7e5680..24b333e 100644 --- a/src/beautifulsoup/tests/test_soup.py +++ b/src/beautifulsoup/tests/test_soup.py @@ -8,9 +8,14 @@ case like this that fails.""" import re import unittest from beautifulsoup import * -from element import CData, Comment, Declaration, SoupStrainer, Tag -from builder import ICantBelieveItsValidHTMLTreeBuilder -from dammit import UnicodeDammit +from beautifulsoup.element import CData, Comment, Declaration, SoupStrainer, Tag +from beautifulsoup.builder import ICantBelieveItsValidHTMLTreeBuilder +from beautifulsoup.dammit import UnicodeDammit + + +def additional_tests(): + return unittest.TestLoader().loadTestsFromName(__name__) + class SoupTest(unittest.TestCase): @@ -849,6 +854,5 @@ class AlternateBuilders(SoupTest): soup = BeautifulSoup(markup, builder=builder) self.assertEquals(soup.decode(), markup) - if __name__ == '__main__': unittest.main() |