@@ -513,83 +513,92 @@ def test_len_if():
513513 if with_len :
514514 pass
515515
516- # # object.__length_hint__(self)
517- # # object.__getitem__(self, key)
518- # class With_getitem:
516+ # object.__length_hint__(self)
517+ class With_length_hint :
519518
520- # def __getitem__ (self, key ):
521- # OK()
522- # return "" # edit to match type
519+ def __length_hint__ (self ):
520+ OK ()
521+ return 0
523522
524- # def test_getitem():
525- # with_getitem = With_getitem()
526- # getitem(with_getitem) # edit to effect call
523+ def test_length_hint ():
524+ import operator
525+ with_length_hint = With_length_hint ()
526+ operator .length_hint (with_length_hint )
527527
528- # # object.__setitem__ (self, key, value )
529- # class With_setitem :
528+ # object.__getitem__ (self, key)
529+ class With_getitem :
530530
531- # def __setitem__ (self, key, value ):
532- # OK()
533- # return "" # edit to match type
531+ def __getitem__ (self , key ):
532+ OK ()
533+ return ""
534534
535- # def test_setitem ():
536- # with_setitem = With_setitem ()
537- # setitem(with_setitem) # edit to effect call
535+ def test_getitem ():
536+ with_getitem = With_getitem ()
537+ with_getitem [ 0 ]
538538
539- # # object.__delitem__ (self, key)
540- # class With_delitem :
539+ # object.__setitem__ (self, key, value )
540+ class With_setitem :
541541
542- # def __delitem__(self, key):
543- # OK()
544- # return "" # edit to match type
542+ def __setitem__ (self , key , value ):
543+ OK ()
545544
546- # def test_delitem ():
547- # with_delitem = With_delitem ()
548- # delitem(with_delitem) # edit to effect call
545+ def test_setitem ():
546+ with_setitem = With_setitem ()
547+ with_setitem [ 0 ] = ""
549548
550- # # object.__missing__ (self, key)
551- # class With_missing :
549+ # object.__delitem__ (self, key)
550+ class With_delitem :
552551
553- # def __missing__(self, key):
554- # OK()
555- # return "" # edit to match type
552+ def __delitem__ (self , key ):
553+ OK ()
556554
557- # def test_missing ():
558- # with_missing = With_missing ()
559- # missing(with_missing) # edit to effect call
555+ def test_delitem ():
556+ with_delitem = With_delitem ()
557+ del with_delitem [ 0 ]
560558
561- # # object.__iter__ (self)
562- # class With_iter :
559+ # object.__missing__ (self, key )
560+ class With_missing ( dict ) :
563561
564- # def __iter__ (self):
565- # OK()
566- # return "" # edit to match type
562+ def __missing__ (self , key ):
563+ OK ()
564+ return ""
567565
568- # def test_iter ():
569- # with_iter = With_iter ()
570- # iter(with_iter) # edit to effect call
566+ def test_missing ():
567+ with_missing = With_missing ()
568+ with_missing [ "" ]
571569
572- # # object.__reversed__ (self)
573- # class With_reversed :
570+ # object.__iter__ (self)
571+ class With_iter :
574572
575- # def __reversed__ (self):
576- # OK()
577- # return "" # edit to match type
573+ def __iter__ (self ):
574+ OK ()
575+ return []. __iter__ ()
578576
579- # def test_reversed ():
580- # with_reversed = With_reversed ()
581- # reversed(with_reversed) # edit to effect call
577+ def test_iter ():
578+ with_iter = With_iter ()
579+ [ x for x in with_iter ]
582580
583- # # object.__contains__ (self, item )
584- # class With_contains :
581+ # object.__reversed__ (self)
582+ class With_reversed :
585583
586- # def __contains__(self, item):
587- # OK()
588- # return "" # edit to match type
584+ def __reversed__ (self ):
585+ OK ()
586+ return [].__iter__
587+
588+ def test_reversed ():
589+ with_reversed = With_reversed ()
590+ reversed (with_reversed )
591+
592+ # object.__contains__(self, item)
593+ class With_contains :
594+
595+ def __contains__ (self , item ):
596+ OK ()
597+ return True
589598
590- # def test_contains():
591- # with_contains = With_contains()
592- # contains(with_contains) # edit to effect call
599+ def test_contains ():
600+ with_contains = With_contains ()
601+ 0 in with_contains
593602
594603
595604# # 3.3.8. Emulating numeric types
0 commit comments