Md Kaif 005550e92a
fix(str): zfill should preserve a leading sign (#533)
zfill writes the padding zeros before the whole string, so a leading
+ or - ends up in the middle of the result instead of staying in front.
For example "-5".zfill(4) gave '00-5' where CPython gives '-005'.

CPython inserts the padding after the sign character, and the sign
counts toward the requested width. Write the sign first, then the
zeros, then the rest of the string. delta is still computed before
this, so the total length is unchanged.

The existing tests only covered unsigned strings, which is why this
went unnoticed. Added three asserts alongside them.
2026-07-21 19:09:11 +08:00
..
2026-01-26 17:24:29 +08:00
...
2023-08-28 13:17:58 +08:00
2026-01-26 17:24:29 +08:00
2026-01-26 17:24:29 +08:00
2025-06-22 16:31:46 +08:00
2026-03-28 17:53:39 +08:00
2025-12-04 21:01:29 +08:00
2026-01-14 16:14:08 +08:00
2026-01-26 17:50:03 +08:00
2026-03-04 14:30:35 +08:00
2025-12-04 21:01:29 +08:00
2025-12-25 18:12:04 +08:00
2026-02-05 11:20:11 +08:00
2026-02-02 21:45:11 +08:00
2026-01-26 17:24:29 +08:00
2026-01-26 17:24:29 +08:00
2026-07-11 10:25:27 +08:00
2025-12-04 21:01:29 +08:00
2026-01-30 14:40:05 +08:00
up
2026-02-21 21:08:33 +08:00
2026-01-14 16:49:02 +08:00
up
2026-02-21 21:08:33 +08:00
2026-02-05 11:27:12 +08:00
2025-12-04 21:01:29 +08:00
2026-06-18 09:27:39 +08:00
2026-01-30 14:42:45 +08:00
2025-12-04 21:01:29 +08:00
up
2026-02-21 21:08:33 +08:00
2026-04-17 11:10:55 +08:00
2025-12-16 17:10:45 +08:00
2026-01-06 15:11:39 +08:00
2026-01-06 15:11:39 +08:00
2026-02-23 00:35:00 +08:00
2026-02-21 21:12:52 +08:00
2025-12-04 21:01:29 +08:00
2026-07-06 12:00:58 +08:00