diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-22 12:02:04 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-22 12:02:04 +0300 |
commit | b652ee705b7378211250bebb478a3894836350bb (patch) | |
tree | c7236b50d27a41628457a501bd939fd971979230 /tests/basics/bytes_compare3.py | |
parent | 40214b9e26408ceb0e4eb92a57f59302b38fa6f9 (diff) | |
download | micropython-b652ee705b7378211250bebb478a3894836350bb.tar.gz micropython-b652ee705b7378211250bebb478a3894836350bb.zip |
tests/bytes_compare: Rework test for bytes <-> str comparison.
This may produce a warning, depending on MicroPython configuration.
Diffstat (limited to 'tests/basics/bytes_compare3.py')
-rw-r--r-- | tests/basics/bytes_compare3.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/bytes_compare3.py b/tests/basics/bytes_compare3.py new file mode 100644 index 0000000000..4b9cbd5b3a --- /dev/null +++ b/tests/basics/bytes_compare3.py @@ -0,0 +1,9 @@ +# Based on MicroPython config option, comparison of str and bytes +# or vice versa may issue a runtime warning. On CPython, if run as +# "python3 -b", only comparison of str to bytes issues a warning, +# not the other way around (while exactly comparison of bytes to +# str would be the most common error, as in sock.recv(3) == "GET"). +# Update: the issue above with CPython apparently happens in REPL, +# when run as a script, both lines issue a warning. +print("123" == b"123") +print(b"123" == "123") |