bpo-35512: Resolve string target to patch.dict decorator during function call GHGH-12000 (#12021)

* Resolve string target to patch.dict during function call

* Add NEWS entry

* Remove unneeded call

* Restore original value for support.target and refactor assertions

* Add extra assertion to verify unpatched dict
(cherry picked from commit a875ea58b29fbf510f9790ae1653eeaa47dc0de8)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 42fbc22..c97ea79 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -1595,8 +1595,6 @@
     """
 
     def __init__(self, in_dict, values=(), clear=False, **kwargs):
-        if isinstance(in_dict, str):
-            in_dict = _importer(in_dict)
         self.in_dict = in_dict
         # support any argument supported by dict(...) constructor
         self.values = dict(values)
@@ -1637,6 +1635,8 @@
 
     def _patch_dict(self):
         values = self.values
+        if isinstance(self.in_dict, str):
+            self.in_dict = _importer(self.in_dict)
         in_dict = self.in_dict
         clear = self.clear