##// END OF EJS Templates
Add cpython2_only decorator...
Add cpython2_only decorator The test_pretty.test_dictproxy now is properly skipped on PyPy

File last commit:

r22425:566cfa83
r22750:4518b9af
Show More
test_prompts.py
37 lines | 1.0 KiB | text/x-python | PythonLexer
MinRK
add failing test for unicode cwd in prompts
r7570 # -*- coding: utf-8
Thomas Kluyver
Add tests for prompt system.
r5658 """Tests for prompt generation."""
import unittest
Thomas Kluyver
Remove PromptManager class...
r22425 from IPython.core.prompts import LazyEvaluate
Thomas Kluyver
Add tests for prompt system.
r5658 from IPython.testing.globalipapp import get_ipython
Thomas Kluyver
Replace references to unicode and basestring
r13353 from IPython.utils.py3compat import unicode_type
Thomas Kluyver
Add tests for prompt system.
r5658
ip = get_ipython()
class PromptTests(unittest.TestCase):
MinRK
test LazyEvaluate with non-ascii input
r7577 def test_lazy_eval_unicode(self):
u = u'ünicødé'
lz = LazyEvaluate(lambda : u)
MinRK
use cleaner, less safe, unicode/str in LazyEvaluate
r7581 # str(lz) would fail
Thomas Kluyver
Replace references to unicode and basestring
r13353 self.assertEqual(unicode_type(lz), u)
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(format(lz), u)
MinRK
test LazyEvaluate with non-ascii input
r7577
def test_lazy_eval_nonascii_bytes(self):
u = u'ünicødé'
b = u.encode('utf8')
lz = LazyEvaluate(lambda : b)
MinRK
use cleaner, less safe, unicode/str in LazyEvaluate
r7581 # unicode(lz) would fail
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(str(lz), str(b))
self.assertEqual(format(lz), str(b))
MinRK
test LazyEval with float and format string
r7579
def test_lazy_eval_float(self):
f = 0.503
lz = LazyEvaluate(lambda : f)
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(str(lz), str(f))
Thomas Kluyver
Replace references to unicode and basestring
r13353 self.assertEqual(unicode_type(lz), unicode_type(f))
Bradley M. Froehle
s/assertEquals/assertEqual/
r7874 self.assertEqual(format(lz), str(f))
self.assertEqual(format(lz, '.1'), '0.5')
Aaron Meurer
Be a little smarter about invisible characters in terminal prompts...
r21605