docstr: Test override_args_kwargs.
docstr_tok: ["Test","override_args_kwargs","."]
code: def test_override_args_kwargs(self):
      """Test override_args_kwargs."""
  
      def f1(a, b, c, d=1, *, e=2, f=3, **kwargs):
          pass
  
      args, kwargs = objax.util.override_args_kwargs(
          f1, [1], {"c": 4}, {"d": 3, "x": 10}
      )
      self.assertEqual(args, [1])
      self.assertEqual(kwargs, {"c": 4, "d": 3, "x": 10})
  
      args, kwargs = objax.util.override_args_kwargs(
          f1, [1, 2], {"e": 4}, {"d": 3, "a": 10}
      )
      self.assertEqual(args, [10, 2])
      self.assertEqual(kwargs, {"e": 4, "d": 3})
  
      def f2(a, b, c, d=1, e=2, f=3):
          pass
  
      args, kwargs = objax.util.override_args_kwargs(
          f2, [1, 2], {"e": 4}, {"d": 3, "x": 10}
      )
      self.assertEqual(args, [1, 2])
      self.assertEqual(kwargs, {"e": 4, "d": 3, "x": 10})
  
      args, kwargs = objax.util.override_args_kwargs(
          f2, [1, 2], {"d": 2}, {"d": 3, "b": 10, "x": 20}
      )
      self.assertEqual(args, [1, 10])
      self.assertEqual(kwargs, {"d": 3, "x": 20})
  
      def f3(a, b, c, *args, d=2, e=3, **kwargs):
          pass
  
      args, kwargs = objax.util.override_args_kwargs(
          f3, [1, 2, 3, 4, 5, 6], {"x": 5}, {"d": 3, "x": 10}
      )
      self.assertEqual(args, [1, 2, 3, 4, 5, 6])
      self.assertEqual(kwargs, {"d": 3, "x": 10})
  
      args, kwargs = objax.util.override_args_kwargs(
          f3, [1, 2, 3, 4, 5, 6], {}, {"d": 3, "b": 10}
      )
      self.assertEqual(args, [1, 10, 3, 4, 5, 6])
      self.assertEqual(kwargs, {"d": 3})
  
      def f4(*args, d=2, e=3):
          pass
  
      args, kwargs = objax.util.override_args_kwargs(
          f4, [1, 2, 3], {"d": 20}, {"d": 3, "a": 10}
      )
      self.assertEqual(args, [1, 2, 3])
      self.assertEqual(kwargs, {"a": 10, "d": 3})
  
file_path: objax/tests/util.py
imports: import re
  import unittest
  import objax
label_desc: Use image node_id 4 for calling the TestUtil obj's underlying member method code with example usage: obj.test_override_args_kwargs() without return types