@@ -4088,6 +4088,49 @@ def test_depr_multi(self):
40884088 check ("a" , b = "b" , c = "c" , d = "d" , e = "e" , f = "f" , g = "g" )
40894089 self .assertRaises (TypeError , fn , a = "a" , b = "b" , c = "c" , d = "d" , e = "e" , f = "f" , g = "g" )
40904090
4091+ def test_lone_kwds (self ):
4092+ with self .assertRaises (TypeError ):
4093+ ac_tester .lone_kwds (1 , 2 )
4094+ self .assertEqual (ac_tester .lone_kwds (), ({},))
4095+ self .assertEqual (ac_tester .lone_kwds (y = 'y' ), ({'y' : 'y' },))
4096+ kwds = {'y' : 'y' , 'z' : 'z' }
4097+ self .assertEqual (ac_tester .lone_kwds (y = 'y' , z = 'z' ), (kwds ,))
4098+ self .assertEqual (ac_tester .lone_kwds (** kwds ), (kwds ,))
4099+
4100+ def test_kwds_with_pos_only (self ):
4101+ with self .assertRaises (TypeError ):
4102+ ac_tester .kwds_with_pos_only ()
4103+ with self .assertRaises (TypeError ):
4104+ ac_tester .kwds_with_pos_only (y = 'y' )
4105+ with self .assertRaises (TypeError ):
4106+ ac_tester .kwds_with_pos_only (1 , y = 'y' )
4107+ self .assertEqual (ac_tester .kwds_with_pos_only (1 , 2 ), (1 , 2 , {}))
4108+ self .assertEqual (ac_tester .kwds_with_pos_only (1 , 2 , y = 'y' ), (1 , 2 , {'y' : 'y' }))
4109+ kwds = {'y' : 'y' , 'z' : 'z' }
4110+ self .assertEqual (ac_tester .kwds_with_pos_only (1 , 2 , y = 'y' , z = 'z' ), (1 , 2 , kwds ))
4111+ self .assertEqual (ac_tester .kwds_with_pos_only (1 , 2 , ** kwds ), (1 , 2 , kwds ))
4112+
4113+ def test_kwds_with_stararg (self ):
4114+ self .assertEqual (ac_tester .kwds_with_stararg (), ((), {}))
4115+ self .assertEqual (ac_tester .kwds_with_stararg (1 , 2 ), ((1 , 2 ), {}))
4116+ self .assertEqual (ac_tester .kwds_with_stararg (y = 'y' ), ((), {'y' : 'y' }))
4117+ args = (1 , 2 )
4118+ kwds = {'y' : 'y' , 'z' : 'z' }
4119+ self .assertEqual (ac_tester .kwds_with_stararg (1 , 2 , y = 'y' , z = 'z' ), (args , kwds ))
4120+ self .assertEqual (ac_tester .kwds_with_stararg (* args , ** kwds ), (args , kwds ))
4121+
4122+ def test_kwds_with_pos_only_and_stararg (self ):
4123+ with self .assertRaises (TypeError ):
4124+ ac_tester .kwds_with_pos_only_and_stararg ()
4125+ with self .assertRaises (TypeError ):
4126+ ac_tester .kwds_with_pos_only_and_stararg (y = 'y' )
4127+ self .assertEqual (ac_tester .kwds_with_pos_only_and_stararg (1 , 2 ), (1 , 2 , (), {}))
4128+ self .assertEqual (ac_tester .kwds_with_pos_only_and_stararg (1 , 2 , y = 'y' ), (1 , 2 , (), {'y' : 'y' }))
4129+ args = ('lobster' , 'thermidor' )
4130+ kwds = {'y' : 'y' , 'z' : 'z' }
4131+ self .assertEqual (ac_tester .kwds_with_pos_only_and_stararg (1 , 2 , 'lobster' , 'thermidor' , y = 'y' , z = 'z' ), (1 , 2 , args , kwds ))
4132+ self .assertEqual (ac_tester .kwds_with_pos_only_and_stararg (1 , 2 , * args , ** kwds ), (1 , 2 , args , kwds ))
4133+
40914134
40924135class LimitedCAPIOutputTests (unittest .TestCase ):
40934136
0 commit comments