Skip to content
Browse files

TST: simpler check for unicode literals (#790)

check using isinstance instead for the length of the string
  • Loading branch information...
1 parent 42e2485 commit 0ffa2ed0b4b9a734a748ffef7790dbdff32169fe @olivierverdier committed Sep 15, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 IPython/core/tests/test_interactiveshell.py
View
8 IPython/core/tests/test_interactiveshell.py
@@ -138,11 +138,11 @@ 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(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'len_unicode_str = len("\xe9")')
- assert ip.user_ns['len_unicode_str'] == 1
+ 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 0ffa2ed

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