Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1049)

Unified Diff: testing_support/tests/auto_stub_test.py

Issue 2186023002: auto_stub.SimpleMock: add sanity - sort kwargs in expectations. (Closed) Base URL: https://chromium.googlesource.com/infra/testing/testing_support.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing_support/auto_stub.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing_support/tests/auto_stub_test.py
diff --git a/testing_support/tests/auto_stub_test.py b/testing_support/tests/auto_stub_test.py
index a3d6aef1992b4cef01ae07db6add3e908b8d066b..3322da9524bd4efa17da8008bfb80d265e1885df 100644
--- a/testing_support/tests/auto_stub_test.py
+++ b/testing_support/tests/auto_stub_test.py
@@ -19,6 +19,17 @@ class TestSimpleMock(unittest.TestCase):
obj.method1(1, param=2)
obj.check_calls(['method1(1, param=2)'])
+ def test_auto_mock_sorted(self):
+ obj = MockedObject(self)
+ obj.method1(1, c=4, a=2, b=3)
+ # tandrii@ is very surprised this is actually deterministic.
+ obj.check_calls(['method1(1, a=2, c=4, b=3)'])
+ # The proper and sane way is to always sort them.
+ obj = MockedObject(self, sorted_kwargs=True)
+ obj.method1(1, c=4, a=2, b=3)
+ obj.check_calls(['method1(1, a=2, b=3, c=4)'])
+
+
def return_one():
return 1
« no previous file with comments | « testing_support/auto_stub.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698