@@ -1505,14 +1505,12 @@ def test_with_fallback(self):
1505
1505
cache .pop ('foo' )
1506
1506
1507
1507
@hashlib_helper .requires_builtin_hashdigest ("_md5" , "md5" )
1508
- @bigmemtest (size = _4G , memuse = 2 , dry_run = False )
1508
+ @bigmemtest (size = _4G , memuse = 2 , dry_run = False )
1509
1509
def test_hmac_digest_overflow_error_no_openssl (self , size ):
1510
1510
hmac = import_fresh_module ("hmac" , blocked = ["_hashlib" ])
1511
1511
1512
- UINT32_MAX = (1 << 32 ) - 1
1513
- self .assertEqual (UINT32_MAX , size - 1 )
1514
- bigkey = b'K' * UINT32_MAX
1515
- bigmsg = b'M' * UINT32_MAX
1512
+ bigkey = b'K' * size
1513
+ bigmsg = b'M' * size
1516
1514
1517
1515
with unittest .mock .patch .object (hmac , "_compute_digest_fallback" ) as f :
1518
1516
self .assertRaises (OverflowError , hmac .digest , bigkey , b'm' , "md5" )
@@ -1525,18 +1523,17 @@ def test_hmac_digest_overflow_error_no_builtin(self, size):
1525
1523
capi = import_helper .import_module ("_testcapi" )
1526
1524
hmac = import_fresh_module ("hmac" , blocked = ["_hmac" ])
1527
1525
1528
- INT_MAX = capi .INT_MAX
1529
- self .assertLessEqual (INT_MAX , size )
1530
- bigkey = b'K' * INT_MAX
1531
- bigmsg = b'M' * INT_MAX
1526
+ self .assertLess (capi .INT_MAX , size )
1527
+ bigkey = b'K' * size
1528
+ bigmsg = b'M' * size
1532
1529
1533
1530
with unittest .mock .patch .object (hmac , "_compute_digest_fallback" ) as f :
1534
1531
self .assertRaises (OverflowError , hmac .digest , bigkey , b'm' , "md5" )
1535
1532
self .assertRaises (OverflowError , hmac .digest , b'k' , bigmsg , "md5" )
1536
1533
f .assert_not_called ()
1537
1534
1538
1535
@hashlib_helper .requires_hashdigest ("md5" , openssl = True )
1539
- @bigmemtest (size = _4G + 1 , memuse = 2 , dry_run = False )
1536
+ @bigmemtest (size = _4G , memuse = 2 , dry_run = False )
1540
1537
def test_hmac_digest_no_overflow_error_in_fallback (self , size ):
1541
1538
hmac = import_fresh_module ("hmac" , blocked = ["_hashlib" , "_hmac" ])
1542
1539
0 commit comments