summaryrefslogtreecommitdiff
path: root/tests/float/float1.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-11-21 15:01:38 +1100
committerDamien George <damien.p.george@gmail.com>2017-11-21 15:01:38 +1100
commita07fc5b6403b9a8bf7e7cb64f857272e5346d7e2 (patch)
tree7a74e3d2d8c4c3925316a5063b9bad4b089bf338 /tests/float/float1.py
parent8667a5f0534238e3144adc35d487deb0ac5be5d6 (diff)
py/objfloat: Allow float() to parse anything with the buffer protocol.
This generalises and simplifies the code and follows CPython behaviour.
Diffstat (limited to 'tests/float/float1.py')
-rw-r--r--tests/float/float1.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/float/float1.py b/tests/float/float1.py
index c64f965a7..54807e5ac 100644
--- a/tests/float/float1.py
+++ b/tests/float/float1.py
@@ -36,6 +36,10 @@ try:
except ValueError:
print("ValueError")
+# construct from something with the buffer protocol
+print(float(b"1.2"))
+print(float(bytearray(b"3.4")))
+
# unary operators
print(bool(0.0))
print(bool(1.2))