Created
June 5, 2012 03:41
-
-
Save ErinCall/2872479 to your computer and use it in GitHub Desktop.
Do these look functionally equivalent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python 2.7 | |
with warnings.catch_warnings(record=False) as w: | |
soup = BeautifulStoneSoup("<b />") | |
self.assertEqual(u"<b/>", unicode(soup.b)) | |
#python 2.5 | |
warnings_manager = warnings.catch_warnings(record=True) | |
w = warnings_manager.__enter__() | |
try: | |
soup = BeautifulStoneSoup("<b />") | |
self.assertEqual(u"<b/>", unicode(soup.b)) | |
except Exception, e: | |
warnings_manager.__exit__(sys.exc_info()) | |
raise | |
else: | |
warnings_manager.__exit__(None, None, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment