From 664bc44f302ca9cbed02788fea4414b815b1ac65 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 20 Dec 2015 16:54:34 +0200 Subject: [PATCH] tests: Add tests for %-formatting of bytes. This requires CPython3.5, to not require switching to it, just use .exp file. --- tests/basics/bytes_format_modulo.py | 7 +++++++ tests/basics/bytes_format_modulo.py.exp | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 tests/basics/bytes_format_modulo.py create mode 100644 tests/basics/bytes_format_modulo.py.exp diff --git a/tests/basics/bytes_format_modulo.py b/tests/basics/bytes_format_modulo.py new file mode 100644 index 0000000000..70246e72dc --- /dev/null +++ b/tests/basics/bytes_format_modulo.py @@ -0,0 +1,7 @@ +# This test requires CPython3.5 +print(b"%%" % ()) +print(b"=%d=" % 1) +print(b"=%d=%d=" % (1, 2)) + +print(b"=%s=" % b"str") +print(b"=%r=" % b"str") diff --git a/tests/basics/bytes_format_modulo.py.exp b/tests/basics/bytes_format_modulo.py.exp new file mode 100644 index 0000000000..782b7f91fc --- /dev/null +++ b/tests/basics/bytes_format_modulo.py.exp @@ -0,0 +1,5 @@ +b'%' +b'=1=' +b'=1=2=' +b'=str=' +b"=b'str'="