@@ -528,9 +528,9 @@ def test_index(self):
528528
529529 def test_count (self ):
530530 b = b'mississippi'
531- self .assertEqual (b .count ('i' ), 4 )
532- self .assertEqual (b .count ('ss' ), 2 )
533- self .assertEqual (b .count ('w' ), 0 )
531+ self .assertEqual (b .count (b 'i' ), 4 )
532+ self .assertEqual (b .count (b 'ss' ), 2 )
533+ self .assertEqual (b .count (b 'w' ), 0 )
534534
535535 def test_append (self ):
536536 b = b'hell'
@@ -551,58 +551,58 @@ def test_insert(self):
551551
552552 def test_startswith (self ):
553553 b = b'hello'
554- self .assertFalse (bytes ().startswith ("anything" ))
555- self .assertTrue (b .startswith ("hello" ))
556- self .assertTrue (b .startswith ("hel" ))
557- self .assertTrue (b .startswith ("h" ))
558- self .assertFalse (b .startswith ("hellow" ))
559- self .assertFalse (b .startswith ("ha" ))
554+ self .assertFalse (bytes ().startswith (b "anything" ))
555+ self .assertTrue (b .startswith (b "hello" ))
556+ self .assertTrue (b .startswith (b "hel" ))
557+ self .assertTrue (b .startswith (b "h" ))
558+ self .assertFalse (b .startswith (b "hellow" ))
559+ self .assertFalse (b .startswith (b "ha" ))
560560
561561 def test_endswith (self ):
562562 b = b'hello'
563- self .assertFalse (bytes ().endswith ("anything" ))
564- self .assertTrue (b .endswith ("hello" ))
565- self .assertTrue (b .endswith ("llo" ))
566- self .assertTrue (b .endswith ("o" ))
567- self .assertFalse (b .endswith ("whello" ))
568- self .assertFalse (b .endswith ("no" ))
563+ self .assertFalse (bytes ().endswith (b "anything" ))
564+ self .assertTrue (b .endswith (b "hello" ))
565+ self .assertTrue (b .endswith (b "llo" ))
566+ self .assertTrue (b .endswith (b "o" ))
567+ self .assertFalse (b .endswith (b "whello" ))
568+ self .assertFalse (b .endswith (b "no" ))
569569
570570 def test_find (self ):
571571 b = b'mississippi'
572- self .assertEqual (b .find ('ss' ), 2 )
573- self .assertEqual (b .find ('ss' , 3 ), 5 )
574- self .assertEqual (b .find ('ss' , 1 , 7 ), 2 )
575- self .assertEqual (b .find ('ss' , 1 , 3 ), - 1 )
576- self .assertEqual (b .find ('w' ), - 1 )
577- self .assertEqual (b .find ('mississippian' ), - 1 )
572+ self .assertEqual (b .find (b 'ss' ), 2 )
573+ self .assertEqual (b .find (b 'ss' , 3 ), 5 )
574+ self .assertEqual (b .find (b 'ss' , 1 , 7 ), 2 )
575+ self .assertEqual (b .find (b 'ss' , 1 , 3 ), - 1 )
576+ self .assertEqual (b .find (b 'w' ), - 1 )
577+ self .assertEqual (b .find (b 'mississippian' ), - 1 )
578578
579579 def test_rfind (self ):
580580 b = b'mississippi'
581- self .assertEqual (b .rfind ('ss' ), 5 )
582- self .assertEqual (b .rfind ('ss' , 3 ), 5 )
583- self .assertEqual (b .rfind ('ss' , 0 , 6 ), 2 )
584- self .assertEqual (b .rfind ('w' ), - 1 )
585- self .assertEqual (b .rfind ('mississippian' ), - 1 )
581+ self .assertEqual (b .rfind (b 'ss' ), 5 )
582+ self .assertEqual (b .rfind (b 'ss' , 3 ), 5 )
583+ self .assertEqual (b .rfind (b 'ss' , 0 , 6 ), 2 )
584+ self .assertEqual (b .rfind (b 'w' ), - 1 )
585+ self .assertEqual (b .rfind (b 'mississippian' ), - 1 )
586586
587587 def test_index (self ):
588588 b = b'world'
589- self .assertEqual (b .index ('w' ), 0 )
590- self .assertEqual (b .index ('orl' ), 1 )
591- self .assertRaises (ValueError , lambda : b .index ( 'worm' ) )
592- self .assertRaises (ValueError , lambda : b .index ( 'ldo' ) )
589+ self .assertEqual (b .index (b 'w' ), 0 )
590+ self .assertEqual (b .index (b 'orl' ), 1 )
591+ self .assertRaises (ValueError , b .index , b 'worm' )
592+ self .assertRaises (ValueError , b .index , b 'ldo' )
593593
594594 def test_rindex (self ):
595595 # XXX could be more rigorous
596596 b = b'world'
597- self .assertEqual (b .rindex ('w' ), 0 )
598- self .assertEqual (b .rindex ('orl' ), 1 )
599- self .assertRaises (ValueError , lambda : b .rindex ( 'worm' ) )
600- self .assertRaises (ValueError , lambda : b .rindex ( 'ldo' ) )
597+ self .assertEqual (b .rindex (b 'w' ), 0 )
598+ self .assertEqual (b .rindex (b 'orl' ), 1 )
599+ self .assertRaises (ValueError , b .rindex , b 'worm' )
600+ self .assertRaises (ValueError , b .rindex , b 'ldo' )
601601
602602 def test_replace (self ):
603603 b = b'mississippi'
604- self .assertEqual (b .replace ('i' , 'a' ), b'massassappa' )
605- self .assertEqual (b .replace ('ss' , 'x' ), b'mixixippi' )
604+ self .assertEqual (b .replace (b 'i' , b 'a' ), b'massassappa' )
605+ self .assertEqual (b .replace (b 'ss' , b 'x' ), b'mixixippi' )
606606
607607 def test_translate (self ):
608608 b = b'hello'
@@ -614,19 +614,19 @@ def test_translate(self):
614614
615615 def test_split (self ):
616616 b = b'mississippi'
617- self .assertEqual (b .split ('i' ), [b'm' , b'ss' , b'ss' , b'pp' , b'' ])
618- self .assertEqual (b .split ('ss' ), [b'mi' , b'i' , b'ippi' ])
619- self .assertEqual (b .split ('w' ), [b ])
617+ self .assertEqual (b .split (b 'i' ), [b'm' , b'ss' , b'ss' , b'pp' , b'' ])
618+ self .assertEqual (b .split (b 'ss' ), [b'mi' , b'i' , b'ippi' ])
619+ self .assertEqual (b .split (b 'w' ), [b ])
620620 # require an arg (no magic whitespace split)
621- self .assertRaises (TypeError , lambda : b .split () )
621+ self .assertRaises (TypeError , b .split )
622622
623623 def test_rsplit (self ):
624624 b = b'mississippi'
625- self .assertEqual (b .rsplit ('i' ), [b'm' , b'ss' , b'ss' , b'pp' , b'' ])
626- self .assertEqual (b .rsplit ('ss' ), [b'mi' , b'i' , b'ippi' ])
627- self .assertEqual (b .rsplit ('w' ), [b ])
625+ self .assertEqual (b .rsplit (b 'i' ), [b'm' , b'ss' , b'ss' , b'pp' , b'' ])
626+ self .assertEqual (b .rsplit (b 'ss' ), [b'mi' , b'i' , b'ippi' ])
627+ self .assertEqual (b .rsplit (b 'w' ), [b ])
628628 # require an arg (no magic whitespace split)
629- self .assertRaises (TypeError , lambda : b .rsplit () )
629+ self .assertRaises (TypeError , b .rsplit )
630630
631631 def test_partition (self ):
632632 b = b'mississippi'
@@ -695,30 +695,11 @@ def fixtype(self, obj):
695695 return obj .encode ("utf-8" )
696696 return super ().fixtype (obj )
697697
698- def checkequal (self , result , object , methodname , * args ):
699- object = bytes (object , "utf-8" )
700- realresult = getattr (bytes , methodname )(object , * args )
701- self .assertEqual (
702- self .fixtype (result ),
703- realresult
704- )
705-
706- def checkraises (self , exc , object , methodname , * args ):
707- object = bytes (object , "utf-8" )
708- self .assertRaises (
709- exc ,
710- getattr (bytes , methodname ),
711- object ,
712- * args
713- )
714-
715698 # Currently the bytes containment testing uses a single integer
716699 # value. This may not be the final design, but until then the
717700 # bytes section with in a bytes containment not valid
718701 def test_contains (self ):
719702 pass
720- def test_find (self ):
721- pass
722703 def test_expandtabs (self ):
723704 pass
724705 def test_upper (self ):
0 commit comments