@@ -347,6 +347,26 @@ def test_is_not(self):
347347 self .assertFalse (operator .is_not (a , b ))
348348 self .assertTrue (operator .is_not (a ,c ))
349349
350+ def test_is_none (self ):
351+ operator = self .module
352+ a = 'xyzpdq'
353+ b = ''
354+ c = None
355+ self .assertRaises (TypeError , operator .is_none )
356+ self .assertFalse (operator .is_none (a ))
357+ self .assertFalse (operator .is_none (b ))
358+ self .assertTrue (operator .is_none (c ))
359+
360+ def test_is_not_none (self ):
361+ operator = self .module
362+ a = 'xyzpdq'
363+ b = ''
364+ c = None
365+ self .assertRaises (TypeError , operator .is_not_none )
366+ self .assertTrue (operator .is_not_none (a ))
367+ self .assertTrue (operator .is_not_none (b ))
368+ self .assertFalse (operator .is_not_none (c ))
369+
350370 def test_attrgetter (self ):
351371 operator = self .module
352372 class A :
@@ -462,6 +482,8 @@ def bar(self, f=42):
462482 return f
463483 def baz (* args , ** kwds ):
464484 return kwds ['name' ], kwds ['self' ]
485+ def return_arguments (self , * args , ** kwds ):
486+ return args , kwds
465487 a = A ()
466488 f = operator .methodcaller ('foo' )
467489 self .assertRaises (IndexError , f , a )
@@ -478,6 +500,17 @@ def baz(*args, **kwds):
478500 f = operator .methodcaller ('baz' , name = 'spam' , self = 'eggs' )
479501 self .assertEqual (f (a ), ('spam' , 'eggs' ))
480502
503+ many_positional_arguments = tuple (range (10 ))
504+ many_kw_arguments = dict (zip ('abcdefghij' , range (10 )))
505+ f = operator .methodcaller ('return_arguments' , * many_positional_arguments )
506+ self .assertEqual (f (a ), (many_positional_arguments , {}))
507+
508+ f = operator .methodcaller ('return_arguments' , ** many_kw_arguments )
509+ self .assertEqual (f (a ), ((), many_kw_arguments ))
510+
511+ f = operator .methodcaller ('return_arguments' , * many_positional_arguments , ** many_kw_arguments )
512+ self .assertEqual (f (a ), (many_positional_arguments , many_kw_arguments ))
513+
481514 def test_inplace (self ):
482515 operator = self .module
483516 class C (object ):
@@ -635,22 +668,20 @@ class PyOperatorTestCase(OperatorTestCase, unittest.TestCase):
635668class COperatorTestCase (OperatorTestCase , unittest .TestCase ):
636669 module = c_operator
637670
638- # TODO: RUSTPYTHON
639- @unittest .expectedFailure
671+ @unittest .expectedFailure # TODO: RUSTPYTHON
640672 def test_attrgetter_signature (self ):
641- super ().test_attrgetter_signature ()
673+ return super ().test_attrgetter_signature ()
642674
643- # TODO: RUSTPYTHON
644- @unittest .expectedFailure
675+ @unittest .expectedFailure # TODO: RUSTPYTHON
645676 def test_itemgetter_signature (self ):
646- super ().test_itemgetter_signature ()
677+ return super ().test_itemgetter_signature ()
647678
648- # TODO: RUSTPYTHON
649- @unittest .expectedFailure
679+ @unittest .expectedFailure # TODO: RUSTPYTHON
650680 def test_methodcaller_signature (self ):
651- super ().test_methodcaller_signature ()
681+ return super ().test_methodcaller_signature ()
652682
653683
684+ @support .thread_unsafe ("swaps global operator module" )
654685class OperatorPickleTestCase :
655686 def copy (self , obj , proto ):
656687 with support .swap_item (sys .modules , 'operator' , self .module ):
0 commit comments