bpo-39915: Ensure await_args_list is updated according to the order in which coroutines were awaited (GH-18927)
Create call objects with awaited arguments instead of using call_args which has only last call value.
(cherry picked from commit e553f204bf0e39b1d701a364bc71b286acb9433f)
Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 204b3e7..a8f74a9 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2136,7 +2136,7 @@
# This is nearly just like super(), except for sepcial handling
# of coroutines
- _call = self.call_args
+ _call = _Call((args, kwargs), two=True)
self.await_count += 1
self.await_args = _call
self.await_args_list.append(_call)