Skip to content

Commit

Permalink
TST: add future unicode_literals test (ipython#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierverdier committed Sep 14, 2011
1 parent 6913fc9 commit 76d224d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions IPython/core/tests/test_interactiveshell.py
Expand Up @@ -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'len_byte_str = len("\xe9")')
assert ip.user_ns['len_byte_str'] == 2
ip.run_cell('from __future__ import unicode_literals')
ip.run_cell(u'len_unicode_str = len("\xe9")')
assert ip.user_ns['len_unicode_str'] == 1
finally:
# Reset compiler flags so we don't mess up other tests.
ip.compile.reset_compiler_flags()

0 comments on commit 76d224d

Please sign in to comment.