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

Side by Side Diff: third_party/protobuf/python/mox.py

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # 2 #
3 # Copyright 2008 Google Inc. 3 # Copyright 2008 Google Inc.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 13 matching lines...) Expand all
24 the expected behavior of the mock object (what methods are to be 24 the expected behavior of the mock object (what methods are to be
25 called on it, with what parameters, what they should return, and in 25 called on it, with what parameters, what they should return, and in
26 what order). 26 what order).
27 27
28 Once you have set up the expected mock behavior, you put it in replay 28 Once you have set up the expected mock behavior, you put it in replay
29 mode. Now the mock responds to method calls just as you told it to. 29 mode. Now the mock responds to method calls just as you told it to.
30 If an unexpected method (or an expected method with unexpected 30 If an unexpected method (or an expected method with unexpected
31 parameters) is called, then an exception will be raised. 31 parameters) is called, then an exception will be raised.
32 32
33 Once you are done interacting with the mock, you need to verify that 33 Once you are done interacting with the mock, you need to verify that
34 all the expected interactions occured. (Maybe your code exited 34 all the expected interactions occurred. (Maybe your code exited
35 prematurely without calling some cleanup method!) The verify phase 35 prematurely without calling some cleanup method!) The verify phase
36 ensures that every expected method was called; otherwise, an exception 36 ensures that every expected method was called; otherwise, an exception
37 will be raised. 37 will be raised.
38 38
39 Suggested usage / workflow: 39 Suggested usage / workflow:
40 40
41 # Create Mox factory 41 # Create Mox factory
42 my_mox = Mox() 42 my_mox = Mox()
43 43
44 # Create a mock data access object 44 # Create a mock data access object
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 Sets up a "mox" attribute which is an instance of Mox - any mox tests will 1392 Sets up a "mox" attribute which is an instance of Mox - any mox tests will
1393 want this. Also automatically unsets any stubs and verifies that all mock 1393 want this. Also automatically unsets any stubs and verifies that all mock
1394 methods have been called at the end of each test, eliminating boilerplate 1394 methods have been called at the end of each test, eliminating boilerplate
1395 code. 1395 code.
1396 """ 1396 """
1397 1397
1398 __metaclass__ = MoxMetaTestBase 1398 __metaclass__ = MoxMetaTestBase
1399 1399
1400 def setUp(self): 1400 def setUp(self):
1401 self.mox = Mox() 1401 self.mox = Mox()
OLDNEW
« no previous file with comments | « third_party/protobuf/python/google/protobuf/text_format.py ('k') | third_party/protobuf/python/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698