Python ConfigParser._Chainmap() Examples
The following are 6
code examples of ConfigParser._Chainmap().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ConfigParser
, or try the search function
.
Example #1
Source File: test_cfgparser.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()
Example #2
Source File: test_cfgparser.py From BinderFilter with MIT License | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()
Example #3
Source File: test_cfgparser.py From oss-ftp with MIT License | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()
Example #4
Source File: test_cfgparser.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()
Example #5
Source File: test_cfgparser.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()
Example #6
Source File: test_cfgparser.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_issue_12717(self): d1 = dict(red=1, green=2) d2 = dict(green=3, blue=4) dcomb = d2.copy() dcomb.update(d1) cm = ConfigParser._Chainmap(d1, d2) self.assertIsInstance(cm.keys(), list) self.assertEqual(set(cm.keys()), set(dcomb.keys())) # keys() self.assertEqual(set(cm.values()), set(dcomb.values())) # values() self.assertEqual(set(cm.items()), set(dcomb.items())) # items() self.assertEqual(set(cm), set(dcomb)) # __iter__ () self.assertEqual(cm, dcomb) # __eq__() self.assertEqual([cm[k] for k in dcomb], dcomb.values()) # __getitem__() klist = 'red green blue black brown'.split() self.assertEqual([cm.get(k, 10) for k in klist], [dcomb.get(k, 10) for k in klist]) # get() self.assertEqual([k in cm for k in klist], [k in dcomb for k in klist]) # __contains__() with test_support.check_py3k_warnings(): self.assertEqual([cm.has_key(k) for k in klist], [dcomb.has_key(k) for k in klist]) # has_key()