tests/cpydiff: Add case for difference in behaviour of bytes.format().

pull/4121/merge
Paul Sokolovsky 2018-09-21 17:13:50 -07:00 zatwierdzone przez Damien George
rodzic a135bca4a1
commit 8181ec04a4
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,7 @@
"""
categories: Types,bytes
description: bytes objects support .format() method
cause: MicroPython strives to be a more regular implementation, so if both `str` and `bytes` support ``__mod__()`` (the % operator), it makes sense to support ``format()`` for both too. Support for ``__mod__`` can also be compiled out, which leaves only ``format()`` for bytes formatting.
workaround: If you are interested in CPython compatibility, don't use ``.format()`` on bytes objects.
"""
print(b'{}'.format(1))