8000 tests: add new tests for uhashlib differences · godlygeek/circuitpython@b2084d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2084d3

Browse files
committed
tests: add new tests for uhashlib differences
.. these tests currently fail, but a subsequent commit will fix them
1 parent d32349c commit b2084d3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/extmod/uhashlib_sha1.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@
1919
sha1 = hashlib.sha1(b'hello')
2020
sha1.update(b'world')
2121
print(sha1.digest())
22+
23+
sha1 = hashlib.sha1(b'hello')
24+
try:
25+
sha1.update(u'world')
26+
except TypeError as e:
27+
print("TypeError")
28+
print(sha1.digest())

tests/extmod/uhashlib_sha256.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323

2424
print(hashlib.sha256(b"\xff" * 64).digest())
2525

26+
sha256 = hashlib.sha256(b'hello')
27+
try:
28+
sha256.update(u'world')
29+
except TypeError as e:
30+
print("TypeError")
31+
print(sha256.digest())
32+
2633
# TODO: running .digest() several times in row is not supported()
2734
#h = hashlib.sha256(b'123')
2835
#print(h.digest())

0 commit comments

Comments
 (0)
0