[Python-checkins] r71134 - python/branches/py3k-short-float-repr/test_float_format.py
mark.dickinson
python-checkins at python.org
Sat Apr 4 11:34:45 CEST 2009
Author: mark.dickinson
Date: Sat Apr 4 11:34:45 2009
New Revision: 71134
Log:
Temporary testing code for float formatting. Needs to be properly
integrated.
Added:
python/branches/py3k-short-float-repr/test_float_format.py
Added: python/branches/py3k-short-float-repr/test_float_format.py
==============================================================================
--- (empty file)
+++ python/branches/py3k-short-float-repr/test_float_format.py Sat Apr 4 11:34:45 2009
@@ -0,0 +1,14 @@
+f = open('Lib/test/formatfloat_testcases.txt')
+
+for line in f:
+ if line.startswith('--'):
+ continue
+ line = line.strip()
+ if not line:
+ continue
+
+ lhs, rhs = map(str.strip, line.split('->'))
+ fmt, arg = lhs.split()
+ print(line)
+ assert fmt % float(arg) == rhs
+ assert fmt % -float(arg) == '-'+rhs
More information about the Python-checkins
mailing list