2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 from test_object_store
import TestObjectStore
9 class TestObjectStoreTest(unittest
.TestCase
):
11 store
= TestObjectStore('namespace')
12 self
.assertEqual(None, store
.Get('hi').Get())
13 self
.assertEqual({}, store
.GetMulti(['hi', 'lo']).Get())
15 def testNonEmpty(self
):
16 store
= TestObjectStore('namespace')
17 store
.Set('hi', 'bye')
18 self
.assertEqual('bye', store
.Get('hi').Get())
19 self
.assertEqual({'hi': 'bye'}, store
.GetMulti(['hi', 'lo']).Get())
20 store
.Set('hi', 'blah')
21 self
.assertEqual('blah', store
.Get('hi').Get())
22 self
.assertEqual({'hi': 'blah'}, store
.GetMulti(['hi', 'lo']).Get())
24 self
.assertEqual(None, store
.Get('hi').Get())
25 self
.assertEqual({}, store
.GetMulti(['hi', 'lo']).Get())
27 def testCheckAndReset(self
):
28 store
= TestObjectStore('namespace')
30 self
.assertTrue(*store
.CheckAndReset(set_count
=1))
33 self
.assertTrue(*store
.CheckAndReset(set_count
=2))
40 self
.assertTrue(*store
.CheckAndReset(get_count
=3, set_count
=2, del_count
=1))
42 if __name__
== '__main__':