@@ -534,8 +534,38 @@ def test_maketrans(self):
534534 self .assertRaises (ValueError , bytes .maketrans , b'abc' , b'xyzq' )
535535 self .assertRaises (TypeError , bytes .maketrans , 'abc' , 'def' )
536536
537- @unittest .expectedFailure
538537 def test_mod (self ):
538+ """
539+ From Py3.5 test suite (post-PEP 461).
540+
541+ The bytes mod code is in _PyBytes_Format() in bytesobject.c in Py3.5.
542+ """
543+ b = b'hello, %b!'
544+ orig = b
545+ b = b % b'world'
546+ self .assertEqual (b , b'hello, world!' )
547+ self .assertEqual (orig , b'hello, %b!' )
548+ self .assertFalse (b is orig )
549+ b = b'%s / 100 = %d%%'
550+ a = b % (b'seventy-nine' , 79 )
551+ self .assertEqual (a , b'seventy-nine / 100 = 79%' )
552+
553+ def test_imod (self ):
554+ """
555+ From Py3.5 test suite (post-PEP 461)
556+ """
557+ b = b'hello, %b!'
558+ orig = b
559+ b %= b'world'
560+ self .assertEqual (b , b'hello, world!' )
561+ self .assertEqual (orig , b'hello, %b!' )
562+ self .assertFalse (b is orig )
563+ b = b'%s / 100 = %d%%'
564+ b %= (b'seventy-nine' , 79 )
565+ self .assertEqual (b , b'seventy-nine / 100 = 79%' )
566+
567+ @unittest .expectedFailure
568+ def test_mod_pep_461 (self ):
539569 """
540570 Test for the PEP 461 functionality (resurrection of %s formatting for
541571 bytes).
0 commit comments