Skip to content

Commit fd13f8a

Browse files
test: improve coverage with Copilot suggestions
Signed-off-by: adityashirsatrao007 <adityashirsatrao007@gmail.com>
1 parent e2b88b5 commit fd13f8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/unit/crypto_utils_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ def test_keccak256():
2020
# "hello" -> 1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8
2121
assert keccak256(b"hello").hex() == "1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8"
2222

23+
# "Transfer" -> 461a29a8a7db848c0827103038dd4776114eb182e0717208d0a793574936353d
24+
assert keccak256(b"Transfer").hex() == "f099cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9"
25+
2326

2427
def test_compress_point_unchecked():
2528
"""Test point compression logic."""
@@ -59,6 +62,16 @@ def test_decompress_point():
5962
assert x2 == nums.x
6063
assert y2 == nums.y
6164

65+
# Test invalid length
66+
with pytest.raises(ValueError, match="Not recognized"):
67+
decompress_point(b'\x04' * 10)
68+
69+
# Test invalid prefix
70+
with pytest.raises(ValueError, match="Not recognized"):
71+
# 0x05 is invalid prefix for 33-byte point
72+
invalid_point = b'\x05' + nums.x.to_bytes(32, 'big')
73+
decompress_point(invalid_point)
74+
6275

6376
def test_compress_with_cryptography():
6477
"""Test compression using cryptography library."""

0 commit comments

Comments
 (0)