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

Side by Side Diff: appengine/findit/libs/test/meta_object_test.py

Issue 2641583002: [Cuprit-finder] Add MetaDict class. (Closed)
Patch Set: Update doc. Created 3 years, 11 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
« no previous file with comments | « appengine/findit/libs/test/meta_dict_serializer_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from libs.meta_object import Element
8 from libs.meta_object import MetaDict
9
10
11 class ElementTest(unittest.TestCase):
12 """Tests ``Element`` class."""
13
14 def testIsElement(self):
15 """Tests that the ``IsElement`` of ``Element`` object returns True."""
16 self.assertTrue(Element().is_element)
17
18
19 class MetaDictTest(unittest.TestCase):
20 """Tests ``MetaDict`` class."""
21
22 def testIsElement(self):
23 """Tests that the ``IsElement`` of ``MetaDict`` object returns True."""
24 self.assertFalse(MetaDict({}).is_element)
25
26 def testMetaDictGetAndSetItem(self):
27 """Tests "get" and "set" item behavior of ``MetaDict``."""
28 d = {'a': 1, 'b': 2, 'c': 3}
29 meta_dict = MetaDict(d)
30 self.assertEqual(meta_dict['a'], d['a'])
31 self.assertEqual(meta_dict.get('b'), d.get('b'))
32 meta_dict['a'] = 9
33 d['a'] = 9
34 self.assertEqual(meta_dict['a'], d['a'])
35
36 def testMetaDictIterDict(self):
37 """Tests iterating ``MetaDict``."""
38 d = {'a': 1, 'b': 2, 'c': 3}
39 meta_dict = MetaDict(d)
40 self.assertListEqual(list(key for key in meta_dict), list(key for key in d))
41 self.assertListEqual(list(meta_dict.iteritems()), list(d.iteritems()))
42 self.assertListEqual(list(meta_dict.itervalues()), list(d.itervalues()))
43 self.assertListEqual(meta_dict.keys(), d.keys())
44 self.assertListEqual(meta_dict.values(), d.values())
45 self.assertEqual(MetaDict(d), MetaDict(d))
OLDNEW
« no previous file with comments | « appengine/findit/libs/test/meta_dict_serializer_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698