示例#1
0
 def test_kwarg_override(self):
     assert lw.get('color', self.b, color='maize') == 'maize'
示例#2
0
 def test_fallback_obj(self):
     assert lw.get('color', self.a, self.b) == 'crimson'
     assert lw.get('size', self.a, self.b) == 2
示例#3
0
 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'
示例#4
0
 def test_get_obj_attr(self):
     assert lw.get('color', self.a) == 'crimson'
示例#5
0
 def test_get_missing_attr(self):
     assert lw.get('size', self.a) is None
示例#6
0
 def test_kwarg_override(self):
     assert lw.get('color', self.b, color='maize') == 'maize'
示例#7
0
 def test_get_dict_item(self):
     a = {'color': 'gold'}
     assert lw.get('color', a) == 'gold'
示例#8
0
 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'
示例#9
0
 def test_fallback_obj(self):
     assert lw.get('color', self.a, self.b) == 'crimson'
     assert lw.get('size', self.a, self.b) == 2
示例#10
0
 def test_get_missing_attr(self):
     assert lw.get('size', self.a) is None
示例#11
0
 def test_get_obj_attr(self):
     assert lw.get('color', self.a) == 'crimson'
示例#12
0
 def test_get_dict_item(self):
     a = {'color': 'gold'}
     assert lw.get('color', a) == 'gold'