﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7920	Adapt to Decimal repr change in Python 2.6	Karen Tracey <kmtracey@…>	Karen Tracey	"In Python 2.6 (as of beta2) the repr for Decimal changed from using double to single quotes.  Thus all of our tests that rely on Decimal repr fail like so:

{{{
Failed example:
    f.to_python(3)
Expected:
    Decimal(""3"")
Got:
    Decimal('3')
}}}

I asked about this over on the Python lists and feedback is the change is here to stay.  Two suggestions for adapting the tests to be immune to the differences in repr across Python levels were:

1 - monkey-patch the Decimal module:

{{{
  >>> import decimal
  >>> decimal.Decimal.__repr__ = lambda s: 'Decimal(""%s"")' % str(s)
}}}

2 - adapt the tests to use a style like this:

{{{
>>> f.to_python(3) == Decimal('3')
True
}}}

instead of the style we have now.  The first is easier but strikes me a bit hackish, the second is more work but might be a good style to move to generally if changing repr's are not seen as backwards-incompatible changes in Python.

Opinions on how we should adapt?"		closed	Uncategorized	dev		fixed	python26		Accepted	1	0	0	0	0	0
