diff options
author | Leonard Richardson <leonardr@segfault.org> | 2013-05-06 17:07:31 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2013-05-06 17:07:31 -0400 |
commit | eac207a4efeca3e7a78838377aafb4a2b44f43c5 (patch) | |
tree | 87f0dfca533dbdb97b8071e10db907e9c7cefeb0 /bs4/diagnose.py | |
parent | 3442a14c015212f12c892d6b2e0ce6a870b1f78d (diff) |
Added failing test.
Diffstat (limited to 'bs4/diagnose.py')
-rw-r--r-- | bs4/diagnose.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bs4/diagnose.py b/bs4/diagnose.py index 5192a3f..daaf523 100644 --- a/bs4/diagnose.py +++ b/bs4/diagnose.py @@ -24,13 +24,17 @@ def diagnose(data): for parser in basic_parsers: print "Trying to parse your data with %s" % parser + success = False try: soup = BeautifulSoup(data, parser) - print "Here's what %s did with the document:" % parser - print soup.prettify() + success = True except Exception, e: print "%s could not parse the document." % parser traceback.print_exc() + if success: + print "Here's what %s did with the document:" % parser + print soup.prettify() + print "-" * 80 def lxml_trace(data, html=True): |