##// END OF EJS Templates
test LazyEval with float and format string
MinRK -
Show More
@@ -85,11 +85,17 b' class PromptTests(unittest.TestCase):'
85 u = u'ünicødé'
85 u = u'ünicødé'
86 b = u.encode('utf8')
86 b = u.encode('utf8')
87 lz = LazyEvaluate(lambda : b)
87 lz = LazyEvaluate(lambda : b)
88 if py3compat.PY3:
89 self.assertEquals(str(lz), str(b))
88 self.assertEquals(str(lz), str(b))
90 self.assertEquals(format(lz), str(b))
89 self.assertEquals(format(lz), str(b))
91 else:
90 if not py3compat.PY3:
92 self.assertEquals(str(lz), b)
93 self.assertRaises(UnicodeDecodeError, unicode, lz)
91 self.assertRaises(UnicodeDecodeError, unicode, lz)
94 self.assertRaises(UnicodeDecodeError, format, lz)
92
93 def test_lazy_eval_float(self):
94 f = 0.503
95 lz = LazyEvaluate(lambda : f)
96
97 self.assertEquals(str(lz), str(f))
98 self.assertEquals(unicode(lz), unicode(f))
99 self.assertEquals(format(lz), str(f))
100 self.assertEquals(format(lz, '.1'), '0.5')
95
101
General Comments 0
You need to be logged in to leave comments. Login now