Skip to content
Browse files

Merge pull request #790 from olivierverdier/future_unicode_test

TST: add future unicode_literals test (#786)
  • Loading branch information...
2 parents 14ae4c0 + 963bcc5 commit 54e67c3dfcf75aa4a9d76e285750c7135b430d49 @takluyver takluyver committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 IPython/core/tests/test_interactiveshell.py
View
13 IPython/core/tests/test_interactiveshell.py
@@ -133,3 +133,16 @@ def test_future_flags(self):
finally:
# Reset compiler flags so we don't mess up other tests.
ip.compile.reset_compiler_flags()
+
+ def test_future_unicode(self):
+ """Check that unicode_literals is imported from __future__ (gh #786)"""
+ ip = get_ipython()
+ try:
+ ip.run_cell(u'byte_str = "a"')
+ assert isinstance(ip.user_ns['byte_str'], str) # string literals are byte strings by default
+ ip.run_cell('from __future__ import unicode_literals')
+ ip.run_cell(u'unicode_str = "a"')
+ assert isinstance(ip.user_ns['unicode_str'], unicode) # strings literals are now unicode
+ finally:
+ # Reset compiler flags so we don't mess up other tests.
+ ip.compile.reset_compiler_flags()

0 comments on commit 54e67c3

Please sign in to comment.
Something went wrong with that request. Please try again.