summaryrefslogtreecommitdiff
path: root/tests/extmod
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2018-05-06 12:26:10 -0500
committerJeff Epler <jepler@gmail.com>2018-05-06 12:31:53 -0500
commitb2084d37d694df2803756375b62beb2b1ade8b80 (patch)
tree89943c86475b69de9a7e88cd7f16d758919573ca /tests/extmod
parentd32349cee83587e07d927c6ca7781b402a0c1bd1 (diff)
tests: add new tests for uhashlib differences
.. these tests currently fail, but a subsequent commit will fix them
Diffstat (limited to 'tests/extmod')
-rw-r--r--tests/extmod/uhashlib_sha1.py7
-rw-r--r--tests/extmod/uhashlib_sha256.py7
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py
index 4f7066899..9d6427b33 100644
--- a/tests/extmod/uhashlib_sha1.py
+++ b/tests/extmod/uhashlib_sha1.py
@@ -19,3 +19,10 @@ except AttributeError:
sha1 = hashlib.sha1(b'hello')
sha1.update(b'world')
print(sha1.digest())
+
+sha1 = hashlib.sha1(b'hello')
+try:
+ sha1.update(u'world')
+except TypeError as e:
+ print("TypeError")
+print(sha1.digest())
diff --git a/tests/extmod/uhashlib_sha256.py b/tests/extmod/uhashlib_sha256.py
index 3200e8f5c..0322c20de 100644
--- a/tests/extmod/uhashlib_sha256.py
+++ b/tests/extmod/uhashlib_sha256.py
@@ -23,6 +23,13 @@ print(h.digest())
print(hashlib.sha256(b"\xff" * 64).digest())
+sha256 = hashlib.sha256(b'hello')
+try:
+ sha256.update(u'world')
+except TypeError as e:
+ print("TypeError")
+print(sha256.digest())
+
# TODO: running .digest() several times in row is not supported()
#h = hashlib.sha256(b'123')
#print(h.digest())