golang_str: bstr/ustr .format() support
Similarly to %-formatting, let's add support for .format(). This is easier to do because we can leverage string.Formatting and hook into the process by proper subclassing. We do not need to implement parsing and need to only customize handling of 's' and 'r' specifiers. For testing we mostly reuse existing tests for %-formatting by amending them a bit to exercise both %-formatting and format-formatting at the same time: by converting %-format specification into corresponding {}-format specification and verifying formatting result for that to be as expected. Some explicit tests for {}-style .format() are also added.
Showing
Please register or sign in to comment