@@ -728,37 +728,50 @@ def test_hmac_digest_digestmod_parameter(self):
728728
729729
730730class  SanityTestCaseMixin (CreatorMixin ):
731+ 
731732    hmac_class  =  None 
733+     digestname  =  None 
732734
733-     @hashlib_helper .requires_hashdigest ('sha256' ) 
734735    def  test_methods (self ):
735-         h  =  self .hmac_new (b"my secret key" , digestmod = "sha256" )
736-         self .check (h )
737- 
738-     def  check (self , h ):
736+         h  =  self .hmac_new (b"my secret key" , digestmod = self .digestname )
739737        self .assertIsInstance (h , self .hmac_class )
740738        self .assertIsNone (h .update (b"compute the hash of this text!" ))
741739        self .assertIsInstance (h .digest (), bytes )
742740        self .assertIsInstance (h .hexdigest (), str )
743741        self .assertIsInstance (h .copy (), self .hmac_class )
744742
743+     def  test_repr (self ):
744+         raise  NotImplementedError 
745+ 
745746
747+ @hashlib_helper .requires_hashdigest ('sha256' ) 
746748class  PySanityTestCase (ThroughObjectMixin , PyModuleMixin , SanityTestCaseMixin ,
747749                       unittest .TestCase ):
748750
749751    @classmethod  
750752    def  setUpClass (cls ):
751753        super ().setUpClass ()
752754        cls .hmac_class  =  cls .hmac .HMAC 
755+         cls .digestname  =  'sha256' 
756+ 
757+     def  test_repr (self ):
758+         h  =  self .hmac_new (b"my secret key" , digestmod = self .digestname )
759+         self .assertStartsWith (repr (h ), "<hmac.HMAC object at" )
753760
754761
762+ @hashlib_helper .requires_hashdigest ('sha256' , openssl = True ) 
755763class  OpenSSLSanityTestCase (ThroughOpenSSLAPIMixin , SanityTestCaseMixin ,
756764                            unittest .TestCase ):
757765
758766    @classmethod  
759767    def  setUpClass (cls ):
760768        super ().setUpClass ()
761769        cls .hmac_class  =  _hashlib .HMAC 
770+         cls .digestname  =  'sha256' 
771+ 
772+     def  test_repr (self ):
773+         h  =  self .hmac_new (b"my secret key" , digestmod = self .digestname )
774+         self .assertStartsWith (repr (h ), f"<{ self .digestname }  )
762775
763776
764777class  UpdateTestCaseMixin :
0 commit comments