summaryrefslogtreecommitdiff
path: root/tests/micropython/heapalloc_bytesio2.py
diff options
context:
space:
mode:
authorDaniel Tralamazza <daniel@tralamazza.com>2017-08-08 00:45:58 +0200
committerDaniel Tralamazza <daniel@tralamazza.com>2017-08-08 00:45:58 +0200
commitb53b6913147bdee5aef1b54f7728d44580dd0935 (patch)
treecfbfad1ddf3ef386131ec5a39961be70d4b60398 /tests/micropython/heapalloc_bytesio2.py
parent3e0d3d283d5619e52e04dc8484d7bf413e66d130 (diff)
parent6c55cdafa32e4db9e2aaf08b1ec597b4723721ea (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tests/micropython/heapalloc_bytesio2.py')
-rw-r--r--tests/micropython/heapalloc_bytesio2.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/micropython/heapalloc_bytesio2.py b/tests/micropython/heapalloc_bytesio2.py
new file mode 100644
index 000000000..cd76f5807
--- /dev/null
+++ b/tests/micropython/heapalloc_bytesio2.py
@@ -0,0 +1,20 @@
+# Creating BytesIO from immutable object should not immediately
+# copy its content.
+try:
+ import uio
+ import micropython
+ micropython.mem_total
+except (ImportError, AttributeError):
+ print("SKIP")
+ raise SystemExit
+
+
+data = b"1234" * 256
+
+before = micropython.mem_total()
+
+buf = uio.BytesIO(data)
+
+after = micropython.mem_total()
+
+print(after - before < len(data))