##// END OF EJS Templates
Backport PR #14014: Fix %page not working: OInfo not subscriptable error.
Backport PR #14014: Fix %page not working: OInfo not subscriptable error.

File last commit:

r25094:59d93919
r28235:97445609
Show More
test_prompts.py
30 lines | 845 B | 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
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)
Srinivas Reddy Thatiparthy
remove unicode_type function
r23044 self.assertEqual(str(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))
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