diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py index 4f7066899a..9d6427b33f 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 3200e8f5cd..0322c20de4 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())