From ad3abcd324cd841ffddd5d8c2713345eed15f5fd Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 9 Jul 2017 15:04:26 +0300 Subject: [PATCH] tests/cpydiff: Add case for str.ljust/rjust. --- tests/cpydiff/types_str_ljust_rjust.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/cpydiff/types_str_ljust_rjust.py diff --git a/tests/cpydiff/types_str_ljust_rjust.py b/tests/cpydiff/types_str_ljust_rjust.py new file mode 100644 index 0000000000..4985962059 --- /dev/null +++ b/tests/cpydiff/types_str_ljust_rjust.py @@ -0,0 +1,7 @@ +""" +categories: Types,str +description: str.ljust() and str.rjust() not implemented +cause: MicroPython is highly optimized for memory usage. Easy workarounds available. +workaround: Instead of `s.ljust(10)` use `"%-10s" % s`, instead of `s.rjust(10)` use `"% 10s" % s`. Alternatively, `"{:<10}".format(s)` or `"{:>10}".format(s)`. +""" +print('abc'.ljust(10))