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

Unified Diff: testing_support/tests/auto_stub_test.py

Issue 2190703002: Require sanity: sort kwargs expectations. NOT OPTIONAL. (Closed) Base URL: https://chromium.googlesource.com/infra/testing/testing_support.git@master
Patch Set: fix 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 3322da9524bd4efa17da8008bfb80d265e1885df..d459831a01de5ebb91c956656b78b1671aad4502 100644
--- a/testing_support/tests/auto_stub_test.py
+++ b/testing_support/tests/auto_stub_test.py
@@ -21,13 +21,14 @@ class TestSimpleMock(unittest.TestCase):
def test_auto_mock_sorted(self):
obj = MockedObject(self)
+ # Regardless of order here, ...
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)'])
+ obj.method1(1, a=2, c=4, b=3)
+ # ... order here is sorted and hence totally deterministic.
+ obj.check_calls([
+ 'method1(1, a=2, b=3, c=4)',
+ auto_stub.format_call('method1', 1, b=3, c=4, a=2),
+ ])
def return_one():
« 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