brython-dev/brython — pull request #8 by kikocorreoso (2014-09-18 08:11:00+00:00)
Title: PR to fix issue#3 (old style format with signed integer decimal)

Hi.

None of the following tests passed before:
```
assert "%5d" % 3 == ' 3'
assert "%5d" % 3.3 == ' 3'
assert "%5.2d" % 3 == ' 03'
assert "%+5d" % 3 == ' +3'
assert "%-5d" % 3 == '3 '
assert "%#5d" % 3 == ' 3'
assert "%05d" % 3 == '00003'
assert "%+05d" % 3 == '+0003'
assert "%+05d" % -3 == '-0003'
assert "% 03d" % 3 == " 03"
assert "%0 3d" % 3 == " 03"
assert "%+ 3d" % 3 == " +3"
assert "%- 3d" % 3 == " 3 "
try:
"%5d" % '3'
raise Exception('should have raised TypeError')
except TypeError:
pass

assert "%5i" % 3 == ' 3'
assert "%5i" % 3.3 == ' 3'
assert "%5.2i" % 3 == ' 03'
assert "%+5i" % 3 == ' +3'
assert "%-5i" % 3 == '3 '
assert "%#5i" % 3 == ' 3'
assert "%05i" % 3 == '00003'
assert "%+05i" % 3 == '+0003'

assert "%5u" % 3 == ' 3'
assert "%5u" % 3.3 == ' 3'
assert "%5.2u" % 3 == ' 03'
assert "%+5u" % 3 == ' +3'
assert "%-5u" % 3 == '3 '
assert "%#5u" % 3 == ' 3'
assert "%05u" % 3 == '00003'
assert "%+05u" % 3 == '+0003'
```

Please, test this PR and let me know if you find corner cases before merging.

BTW, anyone knows where are the CPython3.x for the old style string formatting (ie, `%`)?
Docs are here: https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting