Mark Summerfield added the comment:

Attached is new version of test_float.py with a few tests to check
str.format() with exponents formats, plus a diff. They test that the
exponent is always 3 digits and that the case of the e in the format is
respected.

Added file: http://bugs.python.org/file8969/test_float.diff
Added file: http://bugs.python.org/file8970/test_float.py

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1600>
__________________________________
*** test_float.py	2007-12-17 08:33:13.000000000 +0000
--- test_float.py.orig	2007-12-17 08:25:43.000000000 +0000
***************
*** 139,157 ****
          self.assertEqual(format( 1.0, '+f'), '+1.000000')
          self.assertEqual(format(-1.0, '+f'), '-1.000000')
  
-         self.assertEqual("1.234e+009", "{0:.3e}".format(1.23405e+9))
-         self.assertEqual("1.234e-009", "{0:.3e}".format(1.23405e-9))
-         self.assertEqual("1.234E+009", "{0:.3E}".format(1.23405e+9))
-         self.assertEqual("1.234E-009", "{0:.3E}".format(1.23405e-9))
-         self.assertEqual("1.234e+027", "{0:.3e}".format(1.23405e+27))
-         self.assertEqual("1.234e-027", "{0:.3e}".format(1.23405e-27))
-         self.assertEqual("1.234E+027", "{0:.3E}".format(1.23405e+27))
-         self.assertEqual("1.234E-027", "{0:.3E}".format(1.23405e-27))
-         self.assertEqual("1.234e+132", "{0:.3e}".format(1.23405e+132))
-         self.assertEqual("1.234e-132", "{0:.3e}".format(1.23405e-132))
-         self.assertEqual("1.234E+132", "{0:.3E}".format(1.23405e+132))
-         self.assertEqual("1.234E-132", "{0:.3E}".format(1.23405e-132))
- 
          # % formatting
          self.assertEqual(format(-1.0, '%'), '-100.000000%')
  
--- 139,144 ----

Attachment: test_float.py
Description: application/python

_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to