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')
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')
def test_get_dotted(self): d = {'foo': 'bar'} dd = api.dotted(d) self.assertTrue(api.get(dd, 'foo') == 'bar')
def test_get_dotted(self): d = {'foo': 'bar'} dd = api.dotted(d) self.assertEqual(api.get(dd, 'foo'), 'bar')
def __getitem__(self, key): return api.get(self._o, key)
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)
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')
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')
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')
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')
def test_get_dotted(self): d = {"foo": "bar"} dd = api.dotted(d) self.assertTrue(api.get(dd, "foo") == "bar")
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)
def get(self, key, default=None): return api.get(self._o, key, default=default)