def test_kwarg_override(self): assert lw.get('color', self.b, color='maize') == 'maize'
def test_fallback_obj(self): assert lw.get('color', self.a, self.b) == 'crimson' assert lw.get('size', self.a, self.b) == 2
def test_fallback_kwargs(self): assert lw.get('color', self.a, self.b, shape='square') == 'crimson' assert lw.get('size', self.a, self.b, shape='square') == 2 assert lw.get('shape', self.a, self.b, shape='square') == 'square'
def test_get_obj_attr(self): assert lw.get('color', self.a) == 'crimson'
def test_get_missing_attr(self): assert lw.get('size', self.a) is None
def test_get_dict_item(self): a = {'color': 'gold'} assert lw.get('color', a) == 'gold'