예제 #1
0
 def test_get(self):
     self.assertTrue(api.get(['foo'], '0') == 'foo')
     self.assertTrue(api.get([['foo']], '0.0') == 'foo')
     self.assertRaises(KeyError, api.get, [], '0')
예제 #2
0
 def test_getdefault(self):
     self.assertTrue(api.get([], '0', 'foo') == 'foo')
     self.assertTrue(api.get([[]], '0.0', 'foo') == 'foo')
     self.assertTrue(api.get([[]], '1.0', 'foo') == 'foo')
예제 #3
0
 def test_get_dotted(self):
     d = {'foo': 'bar'}
     dd = api.dotted(d)
     self.assertTrue(api.get(dd, 'foo') == 'bar')
예제 #4
0
 def test_get_dotted(self):
     d = {'foo': 'bar'}
     dd = api.dotted(d)
     self.assertEqual(api.get(dd, 'foo'), 'bar')
예제 #5
0
 def __getitem__(self, key):
     return api.get(self._o, key)
예제 #6
0
 def test_get_default(self):
     self.assertTrue(api.get({}, 'foo', 'bar') == 'bar')
     self.assertTrue(api.get({'foo': {}}, 'foo.bar', 'rab') == 'rab')
     self.assertTrue(api.get({'foo': 'bar'}, 'oof.bar', None) == None)
예제 #7
0
 def test_get(self):
     self.assertEqual(api.get({'foo': 'bar'}, 'foo'), 'bar')
     self.assertEqual(api.get({'foo': {'bar': 'rab'}}, 'foo.bar'), 'rab')
     self.assertRaises(KeyError, api.get, {}, 'foo')
     self.assertRaises(KeyError, api.get, {'foo': 'bar'}, 'oof.bar')
예제 #8
0
 def test_get(self):
     self.assertTrue(api.get({'foo': 'bar'}, 'foo') == 'bar')
     self.assertTrue(api.get({'foo': {'bar': 'rab'}}, 'foo.bar') == 'rab')
     self.assertRaises(KeyError, api.get, {}, 'foo')
     self.assertRaises(KeyError, api.get, {'foo': 'bar'}, 'oof.bar')
예제 #9
0
 def test_getdefault(self):
     self.assertEqual(api.get([], '0', 'foo'), 'foo')
     self.assertEqual(api.get([[]], '0.0', 'foo'), 'foo')
     self.assertEqual(api.get([[]], '1.0', 'foo'), 'foo')
예제 #10
0
 def test_get_dotted(self):
     d = {'foo': 'bar'}
     dd = api.dotted(d)
     self.assertEqual(api.get(dd, 'foo'), 'bar')
예제 #11
0
 def test_get(self):
     self.assertEqual(api.get(['foo'], '0'), 'foo')
     self.assertEqual(api.get([['foo']], '0.0'), 'foo')
     self.assertRaises(KeyError, api.get, [], '0')
예제 #12
0
파일: test_api.py 프로젝트: ish/dottedish
 def test_get_dotted(self):
     d = {'foo': 'bar'}
     dd = api.dotted(d)
     self.assertTrue(api.get(dd, 'foo') == 'bar')
예제 #13
0
파일: test_api.py 프로젝트: Jarn/dottedish
 def test_get_dotted(self):
     d = {"foo": "bar"}
     dd = api.dotted(d)
     self.assertTrue(api.get(dd, "foo") == "bar")
예제 #14
0
 def __getitem__(self, key):
     return api.get(self._o, key)
예제 #15
0
 def test_get_default(self):
     self.assertEqual(api.get({}, 'foo', 'bar'), 'bar')
     self.assertEqual(api.get({'foo': {}}, 'foo.bar', 'rab'), 'rab')
     self.assertEqual(api.get({'foo': 'bar'}, 'oof.bar', None), None)
예제 #16
0
 def get(self, key, default=None):
     return api.get(self._o, key, default=default)
예제 #17
0
 def test_get(self):
     self.assertEqual(api.get(['foo'], '0'), 'foo')
     self.assertEqual(api.get([['foo']], '0.0'), 'foo')
     self.assertRaises(KeyError, api.get, [], '0')
예제 #18
0
 def test_get_default(self):
     self.assertTrue(api.get({}, 'foo', 'bar') == 'bar')
     self.assertTrue(api.get({'foo': {}}, 'foo.bar', 'rab') == 'rab')
     self.assertTrue(api.get({'foo': 'bar'}, 'oof.bar', None) == None)
예제 #19
0
 def test_getdefault(self):
     self.assertEqual(api.get([], '0', 'foo'), 'foo')
     self.assertEqual(api.get([[]], '0.0', 'foo'), 'foo')
     self.assertEqual(api.get([[]], '1.0', 'foo'), 'foo')
예제 #20
0
 def get(self, key, default=None):
     return api.get(self._o, key, default=default)
예제 #21
0
 def test_get_default(self):
     self.assertEqual(api.get({}, 'foo', 'bar'), 'bar')
     self.assertEqual(api.get({'foo': {}}, 'foo.bar', 'rab'), 'rab')
     self.assertEqual(api.get({'foo': 'bar'}, 'oof.bar', None), None)