def test_partial_mixed_args(self): args = (3,) kwargs = {'instance': {'uuid': 1}} callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs) self.assertEqual(4, len(callargs)) self.assertIn('instance', callargs) self.assertEqual({'uuid': 1}, callargs['instance']) self.assertIn('red', callargs) self.assertEqual(3, callargs['red']) self.assertIn('blue', callargs) self.assertIsNone(callargs['blue'])
def test_partial_args(self): args = ({'uuid': 1}, 3) kwargs = {} callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs) # implicit self counts as an arg self.assertEqual(4, len(callargs)) self.assertIn('instance', callargs) self.assertEqual({'uuid': 1}, callargs['instance']) self.assertIn('red', callargs) self.assertEqual(3, callargs['red']) self.assertIn('blue', callargs) self.assertIsNone(callargs['blue'])
def test_all_kwargs(self): args = () kwargs = {'instance': {'uuid': 1}, 'red': 3, 'blue': 4} callargs = safe_utils.getcallargs(self._test_func, *args, **kwargs) # implicit self counts as an arg self.assertEqual(4, len(callargs)) self.assertIn('instance', callargs) self.assertEqual({'uuid': 1}, callargs['instance']) self.assertIn('red', callargs) self.assertEqual(3, callargs['red']) self.assertIn('blue', callargs) self.assertEqual(4, callargs['blue'])