[PATCH] test_pack_revision_5 failure on Windows
Henri Wiechers
hwiechers at gmail.com
Tue Nov 7 21:56:58 GMT 2006
I've been looking at some of the selftest failures on Windows. One
such failure is:
FAIL: test_xml.TestSerializer.test_pack_revision_5
texts not equal:
- <revision committer="Martin Pool <mbp at sourcefrog.net>"
format="5" inventory_sha1="e79c31c1deb64c163cf660fdedd476dd579ffd41"
revision_id="mbp at sourcefrog.net-20050905080035-e0439293f8b6b9f9"
timestamp="1125907235.211783900" timezone="36000">
?
^^^
+ <revision committer="Martin Pool <mbp at sourcefrog.net>"
format="5" inventory_sha1="e79c31c1deb64c163cf660fdedd476dd579ffd41"
revision_id="mbp at sourcefrog.net-20050905080035-e0439293f8b6b9f9"
timestamp="1125907235.211783886" timezone="36000">
?
The problem is that rev.timestamp is a float and on Windows:
>>> '%.9f' % float('1125907235.211783886')
'1125907235.211783900'
I did a little checking and it seems that this isn't regarded as a
bug. Floats are
really only good for 17 significant digits and the timestamp attribute
is holding 19.
(Even repr(float) rounds to 17 first.)
The attached patch gets the right timestamp attribute by using
"%i" % float_ + ("%.9f" % (float_ - int(float_)))[1:]
Ideally, though, I think that repr(rev.timestamp) should be used instead of a
format with fixed decimal places.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winfix2.patch
Type: application/octet-stream
Size: 2010 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061107/87c84f10/attachment.obj
More information about the bazaar
mailing list