def test_money(): """Tests pluck of keys and nonexistent data.""" d = {"x": 1} md = MagicDot([d, None, d]) assert md.pluck("x").get() == [1, NOT_FOUND, 1]
def test_vote(): """Tests that pluck of noniterable gives type_error""" md = MagicDot(1) with pytest.raises(TypeError): md.pluck('z')
def test_sign(): """Tests pluck of attributes and nonexistent data.""" nt = namedtuple("NT", "x")(1) md = MagicDot([nt, None, nt]) assert md.pluck("x").get() == [1, NOT_FOUND, 1]