From 1700ba3e4f5fe40c6e34eb91e5148988b5ca34c6 2012-06-14 20:12:37 From: MinRK Date: 2012-06-14 20:12:37 Subject: [PATCH] test LazyEval with float and format string --- diff --git a/IPython/core/tests/test_prompts.py b/IPython/core/tests/test_prompts.py index c4409eb..6e67ec1 100644 --- a/IPython/core/tests/test_prompts.py +++ b/IPython/core/tests/test_prompts.py @@ -85,11 +85,17 @@ class PromptTests(unittest.TestCase): u = u'ünicødé' b = u.encode('utf8') lz = LazyEvaluate(lambda : b) - if py3compat.PY3: - self.assertEquals(str(lz), str(b)) - self.assertEquals(format(lz), str(b)) - else: - self.assertEquals(str(lz), b) + self.assertEquals(str(lz), str(b)) + self.assertEquals(format(lz), str(b)) + if not py3compat.PY3: self.assertRaises(UnicodeDecodeError, unicode, lz) - self.assertRaises(UnicodeDecodeError, format, lz) + + def test_lazy_eval_float(self): + f = 0.503 + lz = LazyEvaluate(lambda : f) + + self.assertEquals(str(lz), str(f)) + self.assertEquals(unicode(lz), unicode(f)) + self.assertEquals(format(lz), str(f)) + self.assertEquals(format(lz, '.1'), '0.5')