summaryrefslogtreecommitdiff
path: root/tests/basics/bytes_mult.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-08-13 13:22:24 +0100
committerDamien George <damien.p.george@gmail.com>2014-08-13 13:22:24 +0100
commit9b7a8ee8f1032a1c9172afe0bd3ac5be7780e4a2 (patch)
tree79b3b74827761d1db8b2081a2e1e2be24322a527 /tests/basics/bytes_mult.py
parent9d02780eafd9546354fd3ac429b0211f52331650 (diff)
py: Fix mult by negative number of tuple, list, str, bytes.
Multiplication of a tuple, list, str or bytes now yields an empty sequence (instead of crashing). Addresses issue #799 Also added ability to mult bytes on LHS by integer.
Diffstat (limited to 'tests/basics/bytes_mult.py')
-rw-r--r--tests/basics/bytes_mult.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/bytes_mult.py b/tests/basics/bytes_mult.py
new file mode 100644
index 000000000..0effd938e
--- /dev/null
+++ b/tests/basics/bytes_mult.py
@@ -0,0 +1,12 @@
+# basic multiplication
+print(b'0' * 5)
+
+# check negative, 0, positive; lhs and rhs multiplication
+for i in (-4, -2, 0, 2, 4):
+ print(i * b'12')
+ print(b'12' * i)
+
+# check that we don't modify existing object
+a = b'123'
+c = a * 3
+print(a, c)