Well done, cheers for the contribution and Merry Christmas ! BH
On 24 Dec 2011, at 20:09, Anthon van der Neut <[email protected]> wrote: > I just committed changes for the string .format command. It took a bit, > getting used to git (Interactive rebase already started). > examples/libtest/BuiltinTest.py now has 581 test passed, which came from > 2.7 test_str.py formatting (was 443). > > On the way there I found that the UnitTest assertRaises was masked by > an alias and that because of that those tests where not counted (but > they were executed). > > Almost all of the implementation is taken from pypy and is in Python at > the bottom of pyjslib.py. I simplyfied things a bit. 'format' itself is > javascript extension of the > String.prototype, which calls the _string_format python function which > calls the stuff I ripped out of pypy. > > I wasted about the whole of today on > self.assertRaises(ValueError, '{}'.format) > not raising a ValueError. I thought that I lost the Exception because of > going through javascript to python, but in the end it seems that pyjs > does not support calling '{}'.format whereas python2.7 does. I changed > this to an explicity routine calling format on its first argument and > catching the specified exception ( method raises at the bottom of > pyjslib.py). > > Any feedback is welcome. > > It is now 9pm on Christmas Eve, so you might consider this my Christmas > present to pyjamas ;-) > > Anthon

